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. Get the application's widgets in correct Z-Order?

Get the application's widgets in correct Z-Order?

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 5.9k 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.
  • A Offline
    A Offline
    Asperamanca
    wrote on last edited by
    #1

    How do I get the application's widgets in the correct Z-Order?

    Based on "this suggestion":https://bugreports.qt-project.org/browse/QTBUG-2043?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel QApplication::topLevelWidgets() is probably not the answer.

    Any alternatives?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      What do you mean? Do the widgets appear in wrong order for you? Or maybe you only want to read the widgets in ascending/ descending order?

      If the second option is what you're after, then it should be enough to follow the parent-child tree. The widgets on top are the leaves in that tree, the root is the main window.

      (Z(:^

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Asperamanca
        wrote on last edited by
        #3

        Yes, I want to know which windows are in front, and which are behind.

        First, an application can have multiple top-level widgets. In which order are they?
        Second, among sibling widgets how do I get the order?

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          All top level widgets have no parent, so you can check for (parent == 0). Or you can use "QWidget::isWindow().":http://doc.qt.io/qt-5/qwidget.html#isWindow

          Siblings: they are on the same level, so they have the same equivalent of Z value. At least that is what I suspect.

          (Z(:^

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Asperamanca
            wrote on last edited by
            #5

            However, in both cases you see sibling windows (whether they are top level or not) in a defined z-order: While I type this, my browser window is on top of my Qt Creator window, although both are system-wide top-level windows. Same goes for windows in MDI applications, non-modal dialog, you name it. There is always a defined order in which windows are drawn.

            I can see that Qt cannot deliver this information for other application windows. But within my application, I'd like to know whether dialog A is currently before or behind dialog B.

            1 Reply Last reply
            0
            • sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #6

              [quote author="Asperamanca" date="1418913635"]I can see that Qt cannot deliver this information for other application windows. But within my application, I'd like to know whether dialog A is currently before or behind dialog B.[/quote]

              Indeed, I don't think there are APIs for that in Qt, but I might now know about something.

              (Z(:^

              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