Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-2043

Provide API that returns toplevel windows in the application in their z-order

    XMLWordPrintable

Details

    Description

      On Windows, the following would implement such a function:

      QList<QWidget*> zOrderedWindows()
      {
      QList<QWidget*> orderedWidgets;

      if (!QApplication::topLevelWidgets().count())
      return orderedWidgets;

      HWND first = QApplication::topLevelWidgets().at(0)->winId();
      HWND hwnd = first;
      while (hwnd)

      { QWidget *widget = QWidget::find(hwnd); if (widget && widget->isVisible()) orderedWidgets.append(widget); hwnd = GetNextWindow(hwnd, GW_HWNDNEXT); }

      hwnd = GetNextWindow(first, GW_HWNDPREV);
      while (hwnd)

      { QWidget *widget = QWidget::find(hwnd); if (widget && widget->isVisible()) orderedWidgets.prepend(widget); hwnd = GetNextWindow(hwnd, GW_HWNDPREV); }

      return orderedWidgets;
      }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            sorvig Morten Sørvig
            vhilshei Volker Hilsheimer
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes