The WindowDoesNotAcceptFocus flag is making me thirsty!!!!!!!

  • I need a window with the following properties:

    1. Always on top.
    2. able to receive mouse events (movements and clicks).
    3. Does not steal keyboard focus when clicked on.
    4. Must have the above behaviors for Windows (7, 8, 10), Linux (X11), MacOS X

    I've tried many combination of flags; however, only Qt.WindowStaysOnTopHint | Qt.WindowDoesNotAcceptFocus works (BUT ONLY WORK ON LINUX). The following QML will be our example. Please note that I'm using QML here for simplicity as I've also tried setting the window attributes in C++.

    Window {
        id: root
        width: 640
        height: 480
        visible: true
        flags: Qt.WindowStaysOnTopHint | Qt.WindowDoesNotAcceptFocus

    Here is an animation with the above QML running WITH EXPECTED BEHAVIORS on Linux Mint/Ubuntu. Notice the blinking cursor on line 4 did not get stolen when I click on the window's button.
    alt text

    Here is an animation with the SAME QML running on Windows 10. Notice the blinking cursor on line 4 deactivates as I click on the window's button. Also notice the whole Qt Creator window deactivates. Windows 7 and 8 also behave the same.
    alt text
    MacOS X High Sierra behaves exactly like Windows 10, so I won't make an animation.

    Can someone experienced with Qt give me some advice? Am I using the flags correctly? Did I misunderstand what these flags are supposed to do? Is there a bug that I should be reporting?

  • Moderators

    see QTBUG-36230
    Unfortunately it's just not implemented correctly yet (at least on MS Windows)

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.