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

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



  • Lol! a pop-up message telling me that the topic is too old ahah!

    Anyway, so far the bug is getting really old, 4 years soon! Please Qt, fix it!! I face the same issue by using C++ on Windows 8 and Windows 8.1 with Qt 5.9 . What's the point to release Qt 5.10 when the previous version which is even not 1 year old can't run the basics? 0_o



  • I don't mind seeing people wanting old bugs sorted and asking for attention on the forums. Being noticed is the only way to get an action.

    To bring balance to the force: One thing to highlight an old bug - another thing entirely to argue drop everything for this. I don't want that. I get new things and new things fixed every release... I don't want brakes applied to everything else because they couldn't get to this.

    Ridiculing Qt for releasing new versions while this is outstanding is a ridiculous concept itself. And you probably know it, you're passionate to see this fixed, we get it. I do advocate voicing the wish to have this looked at again - just not how.


  • Moderators

    @amonR2 It will not help asking here to fix the bug - this is user forum. You should comment on the bug instead.


  • Moderators

    @amonR2 said in The WindowDoesNotAcceptFocus flag is making me thirsty!!!!!!!:

    Anyway, so far the bug is getting really old, 4 years soon! Please Qt, fix it!! I face the same issue by using C++ on Windows 8 and Windows 8.1 with Qt 5.9 . What's the point to release Qt 5.10 when the previous version which is even not 1 year old can't run the basics? 0_o

    Since Qt is open source you are welcome to provide the fix.
    If you are not able to do so, i would say be thankful for what you get free of charge.



  • @6thC You call it "Ridiculing", I call it "common sense" or "relevancy". Thank you for your help and contribution.

    @raven-worx First: there's nothing free in life.
    Second: Qt is not free. Opensource and licensed products don't mean free, far from that.
    Third: I am not a Qt API developer, it's not my job.
    Don't get mad but here I have a real question for you: would you accept to be slapped for free?

    @Snotboogie Thanks a lot for the hint.

    Since a solution through Qt does not exist we have to use win32 API for Windows platforms. This function works pretty well for me (windows 8 & 8.1):

    setWindowLongPtr(hwnd, GWL_EXSTYLE, WS_EX_NOACTIVATE);
    

    Regarding Linux, setAttribute(Qt::WA_X11DoNotAcceptFocus); was working fine. But only for Qt 4.8, I have not tried it on Qt 5s yet.


Log in to reply
 

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