Details
-
Bug
-
Resolution: Incomplete
-
P3: Somewhat important
-
None
-
6.6.0
Description
When QMessageBox/QDialog destructor is called the subsequent call of QMessageBoxPrivate::setVisible(false) is called andfollowing portion of code
Q_Q(QMessageBox); if (q->testAttribute(Qt::WA_WState_ExplicitShowHide) && q->testAttribute(Qt::WA_WState_Hidden) != visible) return; // Last minute setup if (autoAddOkButton) q->addButton(QMessageBox::Ok); detectEscapeButton(); if (canBeNativeDialog()) setNativeDialogVisible(visible); // Update WA_DontShowOnScreen based on whether the native dialog was shown, // so that QDialog::setVisible(visible) below updates the QWidget state correctly, // but skips showing the non-native version. q->setAttribute(Qt::WA_DontShowOnScreen, nativeDialogInUse);
is invoked even if visible false is passed.
Which means that for exmaple here we invoke full initialization cicle for button
if (autoAddOkButton)
q->addButton(QMessageBox::Ok);
PROPOSAL
Modify if (autoAddOkButton) to if (autoAddOkButton && visible)