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

[Reg 6.4.3->6.6] Application unusable after closing nested message boxes

    XMLWordPrintable

Details

    • macOS
    • 85f791791 (12.0), 7edff3f15 (dev), c967ee08c (6.7), 7c782dc20 (6.6), dcd6d6586 (tqtc/lts-6.5), fd1beb3e2 (6.6.2)

    Description

      My guess is that the regression is in Qt 6.5 too.

      Run the following little application, click the "open dialogs" button, close the dialogs, and try focus a text edit by clicking or try to click the button again.

      #include <QApplication>
      #include <QMessageBox>
      #include <QPlainTextEdit>
      #include <QPushButton>
      #include <QVBoxLayout>
      
      static void execMessage(const QString &text, QWidget *parent)
      {
          QMessageBox mBox(parent);
          mBox.setText(text);
          mBox.setStandardButtons(QMessageBox::No | QMessageBox::Yes);
          mBox.setDefaultButton(QMessageBox::Yes);
          mBox.exec();
      }
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
      
          QWidget w;
          w.setLayout(new QVBoxLayout);
          auto button = new QPushButton("Open Dialogs");
          w.layout()->addWidget(new QPlainTextEdit);
          w.layout()->addWidget(new QPlainTextEdit);
          w.layout()->addWidget(button);
          QObject::connect(button, &QPushButton::clicked, &w, [&] {
              QMetaObject::invokeMethod(
                  &w,
                  [] { execMessage("second message", QApplication::activeModalWidget()); },
                  Qt::QueuedConnection);
              execMessage("first message", &w);
          });
      
          w.show();
          return a.exec();
      }
      

      Expected: Mouse interaction with the "application" is still possible

      Actual: The application no longer reacts to mouse clicks (or moves). After switching applications away and back again, the previously focussed text edit regains keyboard focus and typing there is still possible, and changing focus with backtab works as well, but clicking with the mouse doesn't have any effect, and the "Quit messageboxes" menu item stays disabled as well (it is not possible to quit the application).

      Attachments

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

        Activity

          People

            vestbo Tor Arne Vestbø
            con Eike Ziller
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: