diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2014-06-07 00:40:44 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-06-07 00:40:44 +0200 |
commit | d9a7ad80f78e7346d6f4dbae2cabe31305d6458f (patch) | |
tree | 26a410780b94c553051b8898d5abaf37a909691b /src/widgets/kernel/qapplication.cpp | |
parent | d707acfc9e357ffc86feb5d9219372c30c5ff157 (diff) | |
parent | 0fcce50af009f97efa2a5c5f2c74415c92830962 (diff) |
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
Diffstat (limited to 'src/widgets/kernel/qapplication.cpp')
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index edb9e9036c..94fcee4553 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -152,6 +152,20 @@ static void clearSystemPalette() QApplicationPrivate::sys_pal = 0; } +static QByteArray get_style_class_name() +{ + QScopedPointer<QStyle> s(QStyleFactory::create(QApplicationPrivate::desktopStyleKey())); + if (!s.isNull()) + return s->metaObject()->className(); + return QByteArray(); +} + +static QByteArray nativeStyleClassName() +{ + static QByteArray name = get_style_class_name(); + return name; +} + #ifdef Q_OS_WINCE int QApplicationPrivate::autoMaximizeThreshold = -1; bool QApplicationPrivate::autoSipEnabled = false; @@ -392,6 +406,8 @@ void qt_init_tooltip_palette(); void qt_cleanup(); QStyle *QApplicationPrivate::app_style = 0; // default application style +bool QApplicationPrivate::overrides_native_style = false; // whether native QApplication style is + // overridden, i.e. not native QString QApplicationPrivate::styleOverride; // style override #ifndef QT_NO_STYLE_STYLESHEET @@ -1153,6 +1169,8 @@ QStyle *QApplication::style() Q_ASSERT(!"No styles available!"); return 0; } + QApplicationPrivate::overrides_native_style = + app_style->objectName() != QApplicationPrivate::desktopStyleKey(); } // take ownership of the style QApplicationPrivate::app_style->setParent(qApp); @@ -1217,6 +1235,9 @@ void QApplication::setStyle(QStyle *style) QStyle *old = QApplicationPrivate::app_style; // save + QApplicationPrivate::overrides_native_style = + nativeStyleClassName() == QByteArray(style->metaObject()->className()); + #ifndef QT_NO_STYLE_STYLESHEET if (!QApplicationPrivate::styleSheet.isEmpty() && !qobject_cast<QStyleSheetStyle *>(style)) { // we have a stylesheet already and a new style is being set |