summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2022-11-10 15:39:46 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2022-11-11 17:48:50 +0100
commitb2de858a8c55b7859d6d85ff3f0dcb8ecc7e1413 (patch)
tree37a9e92149c37d9deab964e6666130e0bb82eafe /src/widgets/dialogs
parentc1088d493ea6255ead844505c5d5676362f00684 (diff)
QColorDialog: Account for native dialog helper not being able to show
The color dialog implementation lazily initializes the widget hierarchy, so that they are not created if we're using a native dialog. But unlike QFileDialog, which does the same, QColorDialog failed to handle the case where the native helper could not show a native dialog. We now correctly lazy initialize the widget hierarchy if the native show fails. The WA_DontShowOnScreen state management has been left out, as it needs some general refactoring. This patch doesn't fix, or regress, any logic related to WA_DontShowOnScreen. Task-number: QTBUG-108153 Change-Id: Icbd506617a2fe302bb61aab977e7c8ea4bd64878 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets/dialogs')
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index e9c7c0a514..d19635bd77 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -2117,10 +2117,13 @@ void QColorDialog::setVisible(bool visible)
d->selectedQColor = QColor();
if (d->nativeDialogInUse) {
- d->setNativeDialogVisible(visible);
- // Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below
- // updates the state correctly, but skips showing the non-native version:
- setAttribute(Qt::WA_DontShowOnScreen);
+ if (d->setNativeDialogVisible(visible)) {
+ // Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below
+ // updates the state correctly, but skips showing the non-native version:
+ setAttribute(Qt::WA_DontShowOnScreen);
+ } else {
+ d->initWidgets();
+ }
} else {
setAttribute(Qt::WA_DontShowOnScreen, false);
}