Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-20768

[Regression] With QtQuick 2.0 it is not possible anymore to get a top level translucent item.

XMLWordPrintable

    • a79e42b8f40317f7275b26637e6735754b21727f(Windows, using blurbehind-DWM effects to work around)

      If the top level item in the QML file is translucent it should be a translucent window. With QtQuick 2.0 and SG it's always white.

      In QtQuick 1.1 :

      #include <QtGui>
      #include <QtDeclarative>
      
      
      int main(int argc, char** argv)
      {
          QApplication app(argc, argv);
          QDeclarativeView * view = new QDeclarativeView;
          view->setAttribute(Qt::WA_TranslucentBackground, true);
          view->viewport()->setAutoFillBackground(false);
          view->setSource(QUrl::fromLocalFile("test.qml"));
          view->show();
          return app.exec();
      }
      

      was working fine.

      On QtQuick 2.0 this snippet doesn't work :

      #include <QtGui>
      #include <QtDeclarative>
      
      
      int main(int argc, char** argv)
      {
          QApplication app(argc, argv);
          QSGView * view = new QSGView;
          view->setAutoFillBackground(false);
          view->setAttribute(Qt::WA_TranslucentBackground, true);
          view->setSource(QUrl::fromLocalFile("test.qml"));
          view->show();
          return app.exec();
      }
      

      It seems there is no viewport() concept in SGView so I set directly on the widget itself.

      This bug is very annoying it makes impossible to implement nice popup in QML or translucent overlays.

      Attached the qml file used in the snippets.

        1. qtbug-20768.tgz
          0.8 kB
        2. test.qml
          0.1 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            sletta Gunnar Sletta
            darktears Alexis Menard
            Votes:
            9 Vote for this issue
            Watchers:
            20 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes