[Solved]With Qt 5.2, is it possible to make a shaped window with .qml file?

  • In Qt 4.8, QWidget with QDeclarativeView can make a shaped window, with the QWidget settings:

    setStyleSheet("background :transparent;");
    setAttribute(Qt::WA_TranslucentBackground, true);

    In Qt 5.2, QQuickView seems different from QDeclarativeView. I tried the same way as in Qt 4.8 but failed.

    I found Shaped Clock Example. Is it the only way for Qt 5.2 to make a shaped window?

    Thanks in advance.


  • Under Win 7 64-bit, the following code can show shaped window defined in .qml file.

    However, the setMask() of QWindow seems not work, so even the transparent area receives mouse event.

    #include <QtGui/QGuiApplication>
    #include "qtquick2applicationviewer.h"

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

    QQuickView viewer;
    return app.exec();


Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.