summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-01-09 13:17:52 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-01-09 14:14:53 +0100
commite0bb9e81ab1a9d71f2893844ea82430467422e21 (patch)
treef4e1b7fce0e815b04ebac237cc4123f9b8b8ea61 /tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
parent349fda471e0df473f38f59c2baae688959d6d273 (diff)
Don't override QDialog::setVisible() to implement native dialogs
Clients who called the base-class implementation in QDialog would as a result start hitting the canBeNativeDialog code path at the start of QDialog::setVisible(), which would show the native dialog, but without updating the QWidget visibility state. To keep things 100% compatible, we shuffle the implementation of QDialog::setVisible() into QDialogPrivate, which allows us to override it in QMessageBoxPrivate and QErrorMessagePrivate. The existing subclasses of QDialog that override setVisible have been left as is, to not cause any unintended behavior change. Pick-to: 6.5 Change-Id: Icafe31a7b84a75049365e4e04b80492de08614d2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp')
-rw-r--r--tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
index 808cd41b28..122170e91d 100644
--- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
+++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
@@ -27,6 +27,7 @@ private slots:
void init();
void sanityTest();
+ void baseClassSetVisible();
void defaultButton();
void escapeButton();
void clickedButton();
@@ -174,6 +175,15 @@ void tst_QMessageBox::sanityTest()
msgBox.exec();
}
+void tst_QMessageBox::baseClassSetVisible()
+{
+ QMessageBox msgBox;
+ msgBox.setText("Hello World");
+ msgBox.QDialog::setVisible(true);
+ QCOMPARE(msgBox.isVisible(), true);
+ msgBox.close();
+}
+
void tst_QMessageBox::button()
{
QMessageBox msgBox;