Popup QML Window with Transparent background, changed 5.14->5.15->6.2
-
Hello,
I have a cross platform application that has a menu popup that can be triggered by hardware at any cursor position with the cursor centered in the popup. This custom menu is not rectangular but circular, and the window itself was transparent. When the user mouses out of the menu, it will close.
In qt 5.14 and prior, everything worked as expected with a transparent window behind the central "menu"
In 5.15, on mac the transparency seems impossible to regain no matter what combination of flags and settings or workarounds I apply, and always is black.
In 6.2, the behavior seems to have changed again. Now there is a window shadow and no longer possible to hide the window frame.
This is the exact same code, simply compiled using 5.14, 5.15, and latest 6.2 on Mac. Here is a small application demonstrating the behavior.
Any thoughts? Any better way to get a transparent window containing a custom drawn QML interface of non-rectangular shape? Windows seems to retain the behavior through all revisions so maybe this is a Mac only bug?
import QtQuick 2.14 import QtQuick.Window 2.14 import QtQuick.Controls 2.14 Window { width: 480 height: 600 visible: true Button { anchors.centerIn: parent text: "Open" onClicked: popup.show() } //oversized transparent popup window that will appear on top of other windows/applications when main is minimized Window { id: popup width: 100 * 3.0 //oversized so we get messages on leaving our mouse area... else mouse exits and no "exit" signal height: 100 * 3.0 //oversized so we get messages on leaving our mouse area... else mouse exits and no "exit" signal flags: Qt.Window | Qt.FramelessWindowHint | Qt.WA_TranslucentBackground | Qt.WindowStaysOnTopHint transientParent: null color: "transparent" //"#00000001" // fully trensparent does not seem to work on some earlier qt verions, since resolved! Rectangle { anchors.centerIn: parent width: 100 height: 100 color: "blue" radius: 10 Text { anchors.centerIn: parent text: "Popup" } MouseArea { anchors.fill: parent hoverEnabled: true onContainsMouseChanged: { if(!containsMouse) { popup.hide(); //button contains it... } } } } } }
-
Have you tried the
Qt.NoDropShadowWindowHint
flag? -
@GrecKo said in Popup QML Window with Transparent background, changed 5.14->5.15->6.2:
Qt.NoDropShadowWindowHint
Thank you,
This will remove the drop shadow on 6.2 (yay), but the transparency that worked prior in 5.14 and all previous is gone in 5.15 and later. It is like the alpha blending is silently ignored or something else overrides it. Also, was not needed prior in 5,14 and earlier and seems different then win desktop behavior.
-
I guess the way forward is to report it as a bug (which it seems it is) and hope for a fix or a workaround.