November 18, 2010

strekazoid strekazoid
Lab Rat
151 posts

Rectangle smooth: doesn’t work when radius is specified

 

Found interesting thing about Rectangle. I have rotation angle specified, and to avoid aliasing I have enabled smooth: true. But if there is also radius: property specified for the rectangle, smooth doesn’t work anymore, and aliasing is again there. Is there any way to avoid aliasing when Rectangle is rotated and radius is specified?

  1.         Rectangle {
  2.             id: frame
  3.             x: image1.x-5
  4.             y: image1.y-5
  5.             radius: 5
  6.             smooth: true
  7.             height:  image1.height + 10
  8.             width:  image1.width + 10
  9.             color: "lightgray"
  10.             scale:  image1.scale
  11.             rotation: image1.rotation
  12.         }

8 replies

November 18, 2010

Alexander Kuchumov Alexander Kuchumov
Lab Rat
377 posts

I’ve tried and it’s work well. But I have last version from gitorious.

November 18, 2010

strekazoid strekazoid
Lab Rat
151 posts

I’ll attach couple of screenshots here.

No radius specified:

Radius 5 specified:

November 18, 2010

strekazoid strekazoid
Lab Rat
151 posts
Alexander Kuchumov wrote:
I’ve tried and it’s work well. But I have last version from gitorious.

Should probably also update mine, this sounds like a bug that could be fixed already.

November 18, 2010

strekazoid strekazoid
Lab Rat
151 posts
Alexander Kuchumov wrote:
I’ve tried and it’s work well. But I have last version from gitorious.

Alexander, would you mind telling what is the repository on gitorious for QML?

November 19, 2010

mbrasser mbrasser
Ant Farmer
452 posts

The latest QML is in the main Qt repository (http://qt.gitorious.org/qt/qt), in the 4.7 branch.

It’s possible this is a graphics system issue — what platform and graphics system are you running with? Do you use QGLWidget for the QDeclarativeView’s viewport?

November 19, 2010

strekazoid strekazoid
Lab Rat
151 posts

what platform and graphics system are you running with? Do you use QGLViewport?

Windows XP, using qmlviewer with default settings.

April 9, 2011

micha4fun micha4fun
Lab Rat
12 posts

Any news regarding this topic? Have the same effect with Qt 4.7.2 and standard Qmlviewer.

  1. import QtQuick 1.0
  2.  
  3. Rectangle
  4. {
  5.     width: 360
  6.     height: 360
  7.  
  8.     Rectangle
  9.     {
  10.         x: 50
  11.         y: 50
  12.  
  13.         radius: 10
  14.         width: 100
  15.         height: 100
  16.         rotation: 20
  17.  
  18.         color: "#ff0000"
  19.         opacity: 0.5
  20.         smooth: true
  21.     }
  22. }

April 19, 2012

jdavet jdavet
Lab Rat
20 posts

I’m experiencing the same issue with Qt 4.8.1 and QtQuick 1.1 on Linux:

  1. import QtQuick 1.1
  2.  
  3. Item {
  4.   width: 150; height: 150
  5.  
  6.   Rectangle {
  7.     width: 100; height: 100
  8.     smooth: true; color: "red"; rotation: 10
  9.     // radius: 5
  10.     anchors.centerIn: parent
  11.   }
  12. }

Without the radius: screenshot of rectangle without rounded corners With the radius: screenshot of rectangle without rounded corners

It is like this both when opening the qml file with qmlviewer, and when manually opening it with a QDeclarativeView like this:

  1. #include <QtGui/QApplication>
  2. #include <QtDeclarative/QDeclarativeView>
  3.  
  4. int main(int argc, char *argv[])
  5. {
  6.   QApplication app(argc, argv);
  7.  
  8.   QDeclarativeView view;
  9.   view.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
  10.   view.setResizeMode( QDeclarativeView::SizeRootObjectToView );
  11.   view.setSource(QUrl("rect.qml"));
  12.   view.show();
  13.  
  14.   return app.exec();
  15. }

Also, switching between “native” and “raster” graphics system does not seem to have an effect.

Any idea what could be causing this?

 
  ‹‹ Replace a moved element into a Flow      [solved] QML from resource system ››

You must log in to post a reply. Not a member yet? Register here!