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

Cannot make transparent (translucent) background for QQuickView

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.0.0 Beta 2
    • Windows 7 x86 32 bit, NVIDIA GeForce GTX 460 with vendor's native latest DirectX and OpenGL drivers, Qt 5.0 beta2 (tested with "ANGLE" and "desktop OpenGL" configurations)
      Linux: works
    • a79e42b8f40317f7275b26637e6735754b21727f

    Description

      I have seen that this bug was already reported by somebody, but i decided to report it once more, because i tried everything and there are not any working solutions about it and it seems to be wrongly forgotten. And in that report it was Linux testing, here i tested it on Windows platform.

      I understand that QQuickView is not QWidget and that it's different from QDeclarativeView component. But when i was using Qt 4.8.x it was greatly usefull feature that allowed to make transparent backroud. It allowed to make QML widget hovering over the screen, splash-screens, and make impressive GUI designs with semi-transparent parts. Now it has been unfortunately regressed in Qt 5.0 and i believe that it can be improved. And i can't back to Qt 4.8 only because of this bug...

      I tested it on Windows 7 x86 32 bit platform with two configurations:
      1. Qt 5.0 beta 2 downloaded from official qt-project.org link (seems to be configured with ANGLE graphics backend).
      2. Qt 5.0 beta 2 downloaded from git on 22/Nov/12, configured with "configure -debug-and-release -opensource -confirm-license -nomake examples -nomake tests -no-icu -opengl desktop -platform win32-msvc2010" (desktop OpenGL backend) and successfully built by myself. And i have latest DirectX and OpenGL vendor's drivers on my NVidia GeForce GTX 460. Also tried all the same on other computer with AMD/ATI videocard.

      There is code below that i used to test it.

      main.cpp :

      QQuickView viewer;
      viewer.setResizeMode(QQuickView::SizeRootObjectToView);
      QSurfaceFormat format;
      format.setAlphaBufferSize(8);
      viewer.setFormat(format);
      viewer.setClearBeforeRendering(true);
      viewer.setColor(QColor(Qt::transparent));
      viewer.setWindowFlags(Qt::FramelessWindowHint);
      viewer.setMainQmlFile(QStringLiteral("qml/Qt5_TEST/main.qml"));
      viewer.show();

      main.qml :

      Rectangle {
        width: 360
        height: 360
        color: "transparent"
        Rectangle {
          x: 50
          y: 50
          width: 100
          height: 100
          color: "blue"
        }
      }

      result is:

      Important notes:
      1. I see the same visual result if i change "Rectangle" to "Item" type in root node and remove "color" property.
      2. If i set there "color" property to "#00000000" or "#FF000000" in root rectangle result is also the same
      3. If i set "opacity" property to 0.0 in root "Rectangle" visual result is the same
      4. But if i set "opacity" property to 1.0 i see result below:

      Related bug reports (not resolved and forgotten):
      1. https://bugreports.qt-project.org/browse/QTBUG-20768
      2. https://bugreports.qt-project.org/browse/QTBUG-24707

      Attachments

        1. bug_qml.png
          bug_qml.png
          14 kB
        2. bug_qml2.png
          bug_qml2.png
          13 kB
        3. qtbug28214.zip
          3 kB

        Issue Links

          For Gerrit Dashboard: QTBUG-28214
          # Subject Branch Project Status CR V

          Activity

            People

              kleint Friedemann Kleint
              avassen Vasily Shchukin
              Votes:
              22 Vote for this issue
              Watchers:
              39 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes