Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. removing "Always On Top" flag doesn't work? (Windows)
QtWS25 Last Chance

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

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 2 Posters 2.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    davecotter
    wrote on last edited by davecotter
    #1

    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?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      davecotter
      wrote on last edited by
      #5

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

      1 Reply Last reply
      0
      • D Offline
        D Offline
        davecotter
        wrote on last edited by davecotter
        #2

        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

        1 Reply Last reply
        0
        • D Offline
          D Offline
          davecotter
          wrote on last edited by
          #3

          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) ?

          1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by mrjj
            #4

            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.

            1 Reply Last reply
            1
            • D Offline
              D Offline
              davecotter
              wrote on last edited by
              #5

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

              1 Reply Last reply
              0
              • mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #6

                Yeah else it will stay over its parent.

                1 Reply Last reply
                0
                • mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #7

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

                  1 Reply Last reply
                  1

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved