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
parent
f42bd772f8
commit
1bf9f725d1
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -110,6 +110,8 @@ public:
|
|||
bool handleColorPickingMouseButtonRelease(QMouseEvent *e);
|
||||
bool handleColorPickingKeyPress(QKeyEvent *e);
|
||||
|
||||
bool canBeNativeDialog() const;
|
||||
|
||||
QWellArray *custom;
|
||||
QWellArray *standard;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue