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. Make main window always stay on top of its child widgets?
Qt 6.11 is out! See what's new in the release blog

Make main window always stay on top of its child widgets?

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 3 Posters 1.2k Views 1 Watching
  • 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.
  • L Offline
    L Offline
    lansing
    wrote on last edited by
    #1

    I have a main window and it can call out a Dialog child window. And I want my main window to always stay on top of the dialog window, but only at the program's level. Adding a flag setWindowFlag(Qt::WindowStaysOnTopHint) in the constructor of the main window wouldn't do it because it makes it stay on top of everything in my desktop.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @lansing said in Make main window always stay on top of its child widgets?:

      And I want my main window to always stay on top of the dialog window,

      So how do you expect to see your dialog then?

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      L 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        @lansing said in Make main window always stay on top of its child widgets?:

        And I want my main window to always stay on top of the dialog window,

        So how do you expect to see your dialog then?

        L Offline
        L Offline
        lansing
        wrote on last edited by
        #3

        @Christian-Ehrlicher

        I will resize my main window smaller. My dialog will update from changes I make in main window, so I need it to be always on top.

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @lansing said in Make main window always stay on top of its child widgets?:

          My dialog will update from changes I make in main window, so I need it to be always on top.

          Strange ui-design... don't set the mainwindow as parent of your dialogs so the main window can overlap them.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          L 1 Reply Last reply
          0
          • Christian EhrlicherC Christian Ehrlicher

            @lansing said in Make main window always stay on top of its child widgets?:

            My dialog will update from changes I make in main window, so I need it to be always on top.

            Strange ui-design... don't set the mainwindow as parent of your dialogs so the main window can overlap them.

            L Offline
            L Offline
            lansing
            wrote on last edited by lansing
            #5

            @Christian-Ehrlicher

            They can be overlapped right now when I click on anyone of them, I just want the main window to always stay on top.

            1 Reply Last reply
            0
            • Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #6

              The active windows is in forground - you can't really change this without asking the window manager (so it's wm dependent, nothing Qt can do for you here)
              Again: strange ui-design...

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              L 1 Reply Last reply
              0
              • Christian EhrlicherC Christian Ehrlicher

                The active windows is in forground - you can't really change this without asking the window manager (so it's wm dependent, nothing Qt can do for you here)
                Again: strange ui-design...

                L Offline
                L Offline
                lansing
                wrote on last edited by
                #7

                @Christian-Ehrlicher

                What if I remove the main window from being the parent of the dialog window and then flag the main windows as Qt::Tool. Will it work?

                1 Reply Last reply
                0
                • gde23G Offline
                  gde23G Offline
                  gde23
                  wrote on last edited by gde23
                  #8

                  So if your mainwindow is maximized or at the position the dialog is at and you open the dialog, you don't want to see it??

                  L 1 Reply Last reply
                  0
                  • gde23G gde23

                    So if your mainwindow is maximized or at the position the dialog is at and you open the dialog, you don't want to see it??

                    L Offline
                    L Offline
                    lansing
                    wrote on last edited by
                    #9

                    @gde23

                    I won't be maximizing my main window, it would be relatively small compare to the dialog.

                    1 Reply Last reply
                    0

                    • Login

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