summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs/qcolordialog.cpp
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@digia.com>2014-02-11 23:08:48 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-12 20:12:17 +0100
commit1bf9f725d19664e7b28857986acefbfdb2b12162 (patch)
tree1a762949f766c3a4fbbc7a3808484fddcc714813 /src/widgets/dialogs/qcolordialog.cpp
parentf42bd772f8110dba13d209d81d8eed0077772185 (diff)
Respect the DontUseNativeDialog option for QColorDialog
By reimplementing canBeNativeDialog() we ensure it is only shown natively if the circumstances are correct. The change was modelled on how QFileDialog implements the same checks. Change-Id: If58e33d6d0547e95975d7c0453901fa592eb96a0 [ChangeLog][QtWidgets][QColorDialog] Ensured QColorDialog::DontUseNativeDialog is respected when showing the dialog. Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/widgets/dialogs/qcolordialog.cpp')
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index 2b7cf8e99f..8866a3e97e 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -1790,6 +1790,21 @@ void QColorDialogPrivate::retranslateStrings()
cs->retranslateStrings();
}
+bool QColorDialogPrivate::canBeNativeDialog() const
+{
+ Q_Q(const QColorDialog);
+ if (nativeDialogInUse)
+ return true;
+ if (q->testAttribute(Qt::WA_DontShowOnScreen))
+ return false;
+ if (q->options() & QColorDialog::DontUseNativeDialog)
+ return false;
+
+ QLatin1String staticName(QColorDialog::staticMetaObject.className());
+ QLatin1String dynamicName(q->metaObject()->className());
+ return (staticName == dynamicName);
+}
+
static const Qt::WindowFlags DefaultWindowFlags =
Qt::Dialog | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint
| Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint;