Add attribute Qt::AA_DontUseNativeDialogs.

The attribute can be set to suppress native dialogs for example
for testing purposes.

Task-number: QTBUG-51074
Change-Id: I35611e07e00b7a060f22b49d6ab6f3b8627f8aca
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
bb10
Friedemann Kleint 2016-02-15 14:27:56 +01:00
parent 9baf824e4d
commit 56ad625f78
5 changed files with 17 additions and 9 deletions

View File

@ -506,6 +506,7 @@ public:
AA_EnableHighDpiScaling = 20,
AA_DisableHighDpiScaling = 21,
AA_UseStyleSheetPropagationInWidgetStyles = 22, // ### Qt 6: remove me
AA_DontUseNativeDialogs = 23,
// Add new attributes before this line
AA_AttributeCount

View File

@ -230,6 +230,10 @@
\l{The Style Sheet Syntax#Inheritance}{The Style Sheet Syntax - Inheritance}
for more details. This value has been added in Qt 5.7.
\value AA_DontUseNativeDialogs All dialogs created while this attribute is
set to true won't use the native dialogs provided by the platform.
This value has been added in Qt 5.7.
The following values are obsolete:
\value AA_ImmediateWidgetCreation This attribute is no longer fully

View File

@ -1909,10 +1909,11 @@ 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)
if (QCoreApplication::testAttribute(Qt::AA_DontUseNativeDialogs)
|| q->testAttribute(Qt::WA_DontShowOnScreen)
|| (q->options() & QColorDialog::DontUseNativeDialog)) {
return false;
}
QLatin1String staticName(QColorDialog::staticMetaObject.className());
QLatin1String dynamicName(q->metaObject()->className());

View File

@ -704,10 +704,11 @@ bool QFileDialogPrivate::canBeNativeDialog() const
Q_Q(const QFileDialog);
if (nativeDialogInUse)
return true;
if (q->testAttribute(Qt::WA_DontShowOnScreen))
return false;
if (q->options() & QFileDialog::DontUseNativeDialog)
if (QCoreApplication::testAttribute(Qt::AA_DontUseNativeDialogs)
|| q->testAttribute(Qt::WA_DontShowOnScreen)
|| (q->options() & QFileDialog::DontUseNativeDialog)) {
return false;
}
QLatin1String staticName(QFileDialog::staticMetaObject.className());
QLatin1String dynamicName(q->metaObject()->className());

View File

@ -1043,10 +1043,11 @@ bool QFontDialogPrivate::canBeNativeDialog() const
Q_Q(const QFontDialog);
if (nativeDialogInUse)
return true;
if (q->testAttribute(Qt::WA_DontShowOnScreen))
return false;
if (options->options() & QFontDialog::DontUseNativeDialog)
if (QCoreApplication::testAttribute(Qt::AA_DontUseNativeDialogs)
|| q->testAttribute(Qt::WA_DontShowOnScreen)
|| (options->options() & QFontDialog::DontUseNativeDialog)) {
return false;
}
QLatin1String staticName(QFontDialog::staticMetaObject.className());
QLatin1String dynamicName(q->metaObject()->className());