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

QApplication::topLevelWidgets() returns internal widgets

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 4.6.0
    • 4.3.0
    • GUI: Window management
    • None
    • 3481db791c3b48e28f1a9531b247adf6562edb71

    Description

      QApplication::topLevelWidgets() will return various internal widgets. These will be different from platform to platform.

      Since the function already takes care of removing QDesktopWidgets from the list it seems reasonable that it should remove all the others as well.

      #include <QApplication>
      #include <QWidget>
      #include <QDebug>
      
      
      int main (int argc, char* argv[])
      {
          QApplication app(argc, argv);
      
          for (int i=0; i<4; ++i) {
              QWidget* w = new QWidget();
              w->setWindowTitle(QString("My Widget %1").arg(i));
              w->move(410*i, 32);
              w->resize(400, 300);
              w->show();
          }
          app.processEvents();
          foreach (QWidget* w, qApp->topLevelWidgets()) {
              qDebug() << "Top Level = :[[" <<w <<"]] Visible ? = ["<< w->isVisible();
          }
      
          return app.exec();
      }
      
      

      Attachments

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

        Activity

          People

            pullatti Prasanth Ullattil
            rve Anders Bakken
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes