macOS: Don't show QMessageBox::about(Qt) as modal windows
The system behavior is to not show these kinds of dialogs as modal, and we've documented that for QMessageBox. However, calling show() instead of exec() is not enough, as the default constructor of QMessageBox will set the modality of the widget to application-modal. We need to explicitly override this. [ChangLog][macOS] QMessageBox::about(Qt) now shows dialog non-modal, as documented. Pick-to: 6.2 Change-Id: I6bb59efb81feb23122276a9eede71b2f20c9d7c6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
3a9b5162e6
commit
aafed07dee
@ -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();
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user