Undocked Toolbar breaks Qt::WindowStaysOnTopHint



  • Hi, this is my first in the Qt community.

    Recently I've started working on a program, and I was introduced to Qt because the lead developer started the program using Qt. I have to say at first I was like "What the heck is Qt and why are we using it." Although, as time has passed and I became more familiar with Qt I've begun to fall in love with it.

    Now that I got that part out of the way I am contacting you guys today regarding an issue I'm experiencing.

    When I undock the Toolbar from the MainWindow and place it at a random location on my screen (undocked) my MainWindow and Toolbar loses its Qt::WindowStaysOnTopHint functionality. How can I prevent this?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you share your QMainWindow setup code ?



  • @SGaist
    Let me know if you need more code. Thanks!

    Was getting blocked for spam when trying to post my code. I put it up on Pastebin. http://pastebin.com/ReER7cgU


  • Lifetime Qt Champion

    One thing you can check: print the content of the flags once the QToolBar has been undocked for both your tool bar as well as your main window.



  • @SGaist said:

    One thing you can check: print the content of the flags once the QToolBar has been undocked for both your tool bar as well as your main window.

    I apologize but how do I do that? I've never really used the toolBar until now and I haven't had luck finding it online.


  • Lifetime Qt Champion

    Connect to the topLevelChanged signal and in the slot print the flags from the QToolBar.



  • @SGaist said:

    Connect to the topLevelChanged signal and in the slot print the flags from the QToolBar.

    I seem to be having difficulties. When I go to undock the toolbar the MainWindow and toolbar will just disappear from view. I have to go into the process manager to kill it.

    I've connected the topLevelChanged to a function that sets the window flags of the toolbar and MainWindow to Qt::WindowStaysOnTopHint.

    I must be making an amateur mistake somewhere here...?


  • Lifetime Qt Champion

    My suggestion wasn't to modify the flags at that moment but just to print them so you can compare them before and after undocking.


Log in to reply
 

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