diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 7b6148b1d2..ac2f8bd2d5 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -1830,6 +1830,7 @@ void QMessageBox::about(QWidget *parent, const QString &title, const QString &te #else msgBox->d_func()->buttonBox->setCenterButtons(true); #endif + msgBox->setModal(false); msgBox->show(); #else msgBox->exec(); @@ -1915,6 +1916,7 @@ void QMessageBox::aboutQt(QWidget *parent, const QString &title) #else msgBox->d_func()->buttonBox->setCenterButtons(true); #endif + msgBox->setModal(false); msgBox->show(); #else msgBox->exec(); diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp index b67f15458c..1363479897 100644 --- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp +++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp @@ -127,11 +127,20 @@ void ExecCloseHelper::timerEvent(QTimerEvent *te) return; QWidget *modalWidget = QApplication::activeModalWidget(); - if (!m_testCandidate && modalWidget) m_testCandidate = modalWidget; - if (m_testCandidate && m_testCandidate == modalWidget) { + QWidget *activeWindow = QApplication::activeWindow(); + if (!m_testCandidate && activeWindow) + m_testCandidate = activeWindow; + + if (!m_testCandidate) + return; + + bool shouldHelp = (m_testCandidate->isModal() && m_testCandidate == modalWidget) + || (!m_testCandidate->isModal() && m_testCandidate == activeWindow); + + if (shouldHelp) { if (m_key == CloseWindow) { m_testCandidate->close(); } else {