Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

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

    General and Desktop
    2
    7
    1690
    Loading More Posts
    • 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
      davecotter last edited by davecotter

      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 Reply Quote 0
      • D
        davecotter last edited by

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

        1 Reply Last reply Reply Quote 0
        • D
          davecotter last edited by davecotter

          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 Reply Quote 0
          • D
            davecotter last edited by

            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 Reply Quote 0
            • mrjj
              mrjj Lifetime Qt Champion last edited by mrjj

              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 Reply Quote 1
              • D
                davecotter last edited by

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

                1 Reply Last reply Reply Quote 0
                • mrjj
                  mrjj Lifetime Qt Champion last edited by

                  Yeah else it will stay over its parent.

                  1 Reply Last reply Reply Quote 0
                  • mrjj
                    mrjj Lifetime Qt Champion last edited by

                    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 Reply Quote 1
                    • First post
                      Last post