Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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?

    @ Rectangle {
    id: frame
    x: image1.x-5
    y: image1.y-5
    radius: 5
    smooth: true
    height: image1.height + 10
    width: image1.width + 10
    color: "lightgray"
    scale: image1.scale
    rotation: image1.rotation
    }@



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





  • [quote author="Alexander Kuchumov" date="1290074507"]I've tried and it's work well. But I have last version from gitorious.[/quote]

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



  • [quote author="Alexander Kuchumov" date="1290074507"]I've tried and it's work well. But I have last version from gitorious.[/quote]

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



  • 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?



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

    Windows XP, using qmlviewer with default settings.



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

    @
    import QtQuick 1.0

    Rectangle
    {
    width: 360
    height: 360

    Rectangle
    {
        x: 50
        y: 50
    
        radius: 10
        width: 100
        height: 100
        rotation: 20
    
        color: "#ff0000"
        opacity: 0.5
        smooth: true
    }
    

    }@



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

    @import QtQuick 1.1

    Item {
    width: 150; height: 150

    Rectangle {
    width: 100; height: 100
    smooth: true; color: "red"; rotation: 10
    // radius: 5
    anchors.centerIn: parent
    }
    }@
    Without the radius: !http://img849.imageshack.us/img849/1858/qmlrectnoradius.png(screenshot of rectangle without rounded corners)! With the radius: !http://img84.imageshack.us/img84/9077/qmlrectradius.png(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:
    @#include <QtGui/QApplication>
    #include <QtDeclarative/QDeclarativeView>

    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);

    QDeclarativeView view;
    view.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
    view.setResizeMode( QDeclarativeView::SizeRootObjectToView );
    view.setSource(QUrl("rect.qml"));
    view.show();

    return app.exec();
    }
    @

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

    Any idea what could be causing this?


Log in to reply