1

I have a transparent application window in Qt. This windows contains elements such as rectangles and buttons. On some computers, everything works fine (the main window is transparent and I see the items on the window). On other computers, instead of being transparent, the window is black.

Important: Transparency seems to work if the transparent object is a rectangle but not if its the ApplicationWindow.

1) I know these other computers can manage transparency because I tried other commercial software with transparency and it works. I just don't know how to do it with Qt 5.

2) Worst case scenario: I guess it's related to the graphic card. In my software, could I ask if the graphic card has the required specs (I don't know what spec is required for transparency) ? How could I do that ?

Here is a simple code to reproduce the problem:

ApplicationWindow {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")

    color:"transparent"

    Rectangle
    {
        width: 150
        height: 150
        color:"red"
    }
}

Thank you very much,

Alex

alecs26
  • 51
  • 6
  • Are there any obvious differences between the computers on which the app works and those on which it doesn't? Are they all the same OS or is the app compiled for multiple OSs? – G.M. Apr 11 '17 at 17:31
  • At first, I thought it was an OS version problem. It worked on Windows 8 and 10 but not on Windows 7 and XP. However, I got it to work on a Windows 7 computer (graphic card NVIDIA) while it does not work on another Windows 7 computer (graphic card ATI RADEON). – alecs26 Apr 11 '17 at 18:16
  • Could it possibly be outdated OpenGL drivers? QtQuick specifically uses OpenGL. Same thing happens using QWidgets? Also, I'm not sure it'll make a difference but have you setting color with RGB or hex instead of using the SVG name? – Tony Clifton Apr 12 '17 at 00:27
  • Yes I tried setting the color with Qt.rgba(0,0,0,0) and "#00000000" but it was the same. Also, there is some software that use transparency (and works) on all these computers without the aero theme. But I don't think they were designed with Qt. One of them was designed with Qt (I see the file QtCore4.dll) but it was Qt4. I think the bug is for Qt5. I found some forums saying that it works on Win7 if the Aero theme is set if it might help to pinpoint the problem... – alecs26 Apr 12 '17 at 01:57
  • Possible duplicate of [Qt Quick2 window can't be transparent without aero](http://stackoverflow.com/questions/42059468/qt-quick2-window-cant-be-transparent-without-aero) – derM - not here for BOT dreams Apr 12 '17 at 07:55
  • Possibly related to this bug: https://bugreports.qt.io/browse/QTBUG-52494 – derM - not here for BOT dreams Apr 12 '17 at 08:04
  • Yes this post seems related to Qt Quick2 window can't be transparent without aero and bugreports.qt.io/browse/QTBUG-52494. However, these posts are old and don't offer solution. – alecs26 Apr 12 '17 at 09:50
  • I tested with the new Qt5.9 beta and it's the same problem. – alecs26 Apr 13 '17 at 11:26
  • Any updates? Same problem on Qt 5.12, Windows 7, No Aero – l2m2 Aug 05 '22 at 07:25

0 Answers0