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>
bb10
Andy Shaw 2014-02-11 23:08:48 +01:00 committed by The Qt Project
parent f42bd772f8
commit 1bf9f725d1
2 changed files with 17 additions and 0 deletions

View File

@ -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;

View File

@ -110,6 +110,8 @@ public:
bool handleColorPickingMouseButtonRelease(QMouseEvent *e);
bool handleColorPickingKeyPress(QKeyEvent *e);
bool canBeNativeDialog() const;
QWellArray *custom;
QWellArray *standard;