Window QML type, color: "transparent"
-
I am using Qt 5.11.1 on Windows 10 with transparency mode setting for toolbars on.
How can I set a Window QML object's color to transparent?
The Window and Screen Qt Quick example shows the following code to create an empty QML Window with which an image can be placed for a splash screen, yet when I try the window is always black.
Window { id: splash color: "transparent" title: "Splash Window" modality: Qt.ApplicationModal flags: Qt.SplashScreen }
I can set opacity: 0 and get a transparent Window, but then all content inside the Window is hidden as well.
Any ideas? Bug?
Thanks.
-
Hi @EStudley , you just need to set the flags property and the color to transparent.
flags: Qt.WA_TranslucentBackground | Qt.FramelessWindowHint color: "#00000000"
Here is the sample code:-
Window { id: splash visible: true height: 500 width: 500 flags: Qt.WA_TranslucentBackground | Qt.FramelessWindowHint color: "#00000000" Rectangle { height: 100 width: 100 color: "cyan" } }
-
But Qt.WA_TranslucentBackground is a widget attribute:
https://doc.qt.io/qt-5/qt.html#WidgetAttribute-enum
not a flag for a window:
https://doc.qt.io/qt-5/qt.html#WindowType-enumIs this how we set attributes for QML? Seems counter intuitive.