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

QMessageBox not being shown when setParent was called

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4: Low
    • None
    • 4.8.7, 5.4.0 RC
    • Windows 7 64 bit
      MSVC 2010 32 bit

    Description

      1. Have a simple main function:
        #include <QApplication>
        #include <QMessageBox>
        
        int main(int argc, char *argv[])
        {
            QApplication a(argc, argv);
            QWidget w;
            QMessageBox mb;
            w.show();
            mb.show();
            return a.exec();
        }
        
      2. Build and run this.
        You'll see a QMessageBox in front of a QWidget.
      3. Assign a parent to the QMessageBox:
            QMessageBox mb;
            mb.setParent(&w);
            w.show();
        
      4. Build and run this.
        The QMessageBox is gone.
      5. Pass the parent to the ctor:
            QMessageBox mb(&w);
            mb.setParent(&w);
        
      6. Build and run this.
        The QMessageBox is back again.

      I think that in all three cases the QMessageBox should be shown.

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            rlohning Robert Löhning
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes