removing "Always On Top" flag doesn't work? (Windows)



  • using: Qt Creator 4.4.0
    Based on Qt 5.9.1 (MSVC 2015, 32 bit)

    i see elsewhere code like this:

    	{
    		Qt::WindowFlags		flags(videoWindow.windowFlags());
    		
    		flags = (flags & ~Qt::WindowStaysOnTopHint) | Qt::WindowStaysOnBottomHint;	
    		videoWindow.setWindowFlags(flags);
    		videoWindow.show();
    	}
    

    which is supposed to remove the "always float above all other app windows", but this simply isn't happening. The window will NOT go behind other windows in the same app, it STILL stays on top.

    What am i missing?



  • even if i do this:

    	SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
    

    it STILL floats above all other windows in the app



  • put another way: on Windows (64 bit), how can i create a window that LOOKS like a "Tool" window (smaller title bar), but behaves like a normal window (ie: doesn't hide when app is not front, and doesn't sit on top of / can go behind other windows in the same app) ?


  • Qt Champions 2017

    Hi
    QWidget* ToolWin=new QWidget(); // no parent. You must delete your self
    ToolWin->setWindowFlag(Qt::Tool);
    ToolWin->show();

    Then it just a normal window that can even fall behind mainwindow and all other
    windows.



  • oh! so just don't pass the parent window when constructing the tool window! wow!


  • Qt Champions 2017

    Yeah else it will stay over its parent.


  • Qt Champions 2017

    Btw this sample is handy to check out the flags
    http://doc.qt.io/qt-5/qtwidgets-widgets-windowflags-example.html


Log in to reply
 

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