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. Set Z-Order of Windows?
Forum Updated to NodeBB v4.3 + New Features

Set Z-Order of Windows?

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 2 Posters 5.1k 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.
  • Q Offline
    Q Offline
    Qt_User72653
    wrote on last edited by
    #1

    I have 4 windows that have the WindowStaysOnTopHint applied to them; is it possible to manually set their z-orders?

    mrjjM 1 Reply Last reply
    0
    • Q Qt_User72653

      I have 4 windows that have the WindowStaysOnTopHint applied to them; is it possible to manually set their z-orders?

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Qt_User72653
      It depends on the windows manger.
      you can try call raise ()
      but im not sure it works with WindowStaysOnTopHint

      1 Reply Last reply
      2
      • Q Offline
        Q Offline
        Qt_User72653
        wrote on last edited by
        #3

        I've tried using raise() but the results have been inconsistent, with the z-order of some windows changing spontaneously. Or, in the case I'm struggling with now, calling raise does nothing initially then later another call to raise actually raises the window.

        I was hoping there was a way to set it absolutely.

        mrjjM 1 Reply Last reply
        1
        • Q Qt_User72653

          I've tried using raise() but the results have been inconsistent, with the z-order of some windows changing spontaneously. Or, in the case I'm struggling with now, calling raise does nothing initially then later another call to raise actually raises the window.

          I was hoping there was a way to set it absolutely.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #4

          @Qt_User72653
          I had similar results on windows.
          What platform are you on ?
          I never saw a function to explicitly set the the z order value.

          note on windows, i had ok result calling
          ->activateWindow(); ->raise()
          to bring a top window to the very front of other tops.

          1 Reply Last reply
          1
          • Q Offline
            Q Offline
            Qt_User72653
            wrote on last edited by
            #5

            Windows 10.

            I guess I'll look into doing this with the Windows API.

            mrjjM 1 Reply Last reply
            0
            • Q Qt_User72653

              Windows 10.

              I guess I'll look into doing this with the Windows API.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by mrjj
              #6

              @Qt_User72653
              Is the goal to control stacking order or
              be able to bring top window in front on demand ?
              if yes to bringtofront, can you try with
              ->setWindowState(Qt::WindowActive) ;

              Q 1 Reply Last reply
              1
              • mrjjM mrjj

                @Qt_User72653
                Is the goal to control stacking order or
                be able to bring top window in front on demand ?
                if yes to bringtofront, can you try with
                ->setWindowState(Qt::WindowActive) ;

                Q Offline
                Q Offline
                Qt_User72653
                wrote on last edited by
                #7

                @mrjj

                To control the stacking order.

                The issue with using activateWindow is that the windows represent a pop-up dialog with a dropdown menu. One window represents the dialog with the line edit and another represents the dropdown list, so activating the window I want to raise takes the focus from the line edit window.

                On top of that, both the dialog and the dropdown list windows' have another window that follow them around that's used to draw a drop shadow. This is where the issue is because the drop shadow for the dialog window overlaps the window for the dropdown list.

                mrjjM 1 Reply Last reply
                0
                • Q Qt_User72653

                  @mrjj

                  To control the stacking order.

                  The issue with using activateWindow is that the windows represent a pop-up dialog with a dropdown menu. One window represents the dialog with the line edit and another represents the dropdown list, so activating the window I want to raise takes the focus from the line edit window.

                  On top of that, both the dialog and the dropdown list windows' have another window that follow them around that's used to draw a drop shadow. This is where the issue is because the drop shadow for the dialog window overlaps the window for the dropdown list.

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @Qt_User72653
                  Did you try fiddling around with FocusPolicy
                  http://doc.qt.io/qt-5/qwidget.html#focusPolicy-prop
                  so only clicking will take focus ?
                  Not sure it helps but no harm mentioned it.

                  Q 1 Reply Last reply
                  0
                  • mrjjM mrjj

                    @Qt_User72653
                    Did you try fiddling around with FocusPolicy
                    http://doc.qt.io/qt-5/qwidget.html#focusPolicy-prop
                    so only clicking will take focus ?
                    Not sure it helps but no harm mentioned it.

                    Q Offline
                    Q Offline
                    Qt_User72653
                    wrote on last edited by
                    #9

                    @mrjj

                    I'm not sure if the focus policy applies here, because the drop shadow never takes any sort of focus, and the dropdown list only takes focus when an item is selected then it's immediately hidden.

                    mrjjM 1 Reply Last reply
                    0
                    • Q Qt_User72653

                      @mrjj

                      I'm not sure if the focus policy applies here, because the drop shadow never takes any sort of focus, and the dropdown list only takes focus when an item is selected then it's immediately hidden.

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @Qt_User72653
                      Hi
                      I mean for the case
                      "activating the window I want to raise takes the focus from the line edit window."
                      but it was a thought.

                      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