qt5base-lts/tests/auto/widgets/dialogs/qmessagebox
Volker Hilsheimer 505ed52cd4 Dialogs: clean up native dialogs when object gets destroyed
QWidget::setVisible is virtual, and called via hide() by both the
QDialog and the QWidget destructor. A dialog that becomes invisible
when getting destroyed will at most execute the QDialog override.
Subclassing QDialog and overriding setVisible() to update the state
of the native platform dialog will not work, unless we explicitly
call hide() in the respective subclass's destructor.

Since e0bb9e81ab, QDialogPrivate::setVisible is
also virtual, and gets called by QDialog::setVisible. So the clean
solution is to move the implementation of the native dialog status
update into an override of QDialogPrivate::setVisible.

Add test that verifies that the transient parent of the dialog
becomes inactive when the (native) dialog shows (and skip if that
fails), and then becomes active again when the (native) dialog is
closed through the destructor of the Q*Dialog class. The test of
QFileDialog has to be skipped on Android for the same reason as the
widgetlessNativeDialog.

Fixes: QTBUG-116277
Pick-to: 6.6 6.5
Change-Id: Ie3f93980d8653b8d933bf70aac3ef90de606f0ef
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-09-06 23:12:33 +02:00
..
.gitignore Moved tests into integrationtests/ and widgets/ 2011-10-20 19:45:41 +02:00
BLACKLIST Test is not flaky any longer 2022-08-10 21:44:39 +02:00
CMakeLists.txt CMake: Make widgets tests standalone projects 2023-07-05 15:09:32 +02:00
tst_qmessagebox.cpp Dialogs: clean up native dialogs when object gets destroyed 2023-09-06 23:12:33 +02:00