diff options
Diffstat (limited to 'src/quickcontrols2/qquickstyleplugin.cpp')
-rw-r--r-- | src/quickcontrols2/qquickstyleplugin.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/quickcontrols2/qquickstyleplugin.cpp b/src/quickcontrols2/qquickstyleplugin.cpp index 1f01da52..fa8e9785 100644 --- a/src/quickcontrols2/qquickstyleplugin.cpp +++ b/src/quickcontrols2/qquickstyleplugin.cpp @@ -65,14 +65,23 @@ void QQuickStylePlugin::initializeEngine(QQmlEngine *engine, const char *uri) if (!m_theme.isNull()) return; - const QString style = name(); - if (!style.isEmpty() && style.compare(QQuickStyle::name(), Qt::CaseInsensitive) == 0) { + if (isCurrent()) { m_theme.reset(createTheme()); if (m_theme) QGuiApplicationPrivate::platform_theme = m_theme.data(); } } +bool QQuickStylePlugin::isCurrent() const +{ + QString style = QQuickStyle::name(); + if (style.isEmpty()) + style = QStringLiteral("Default"); + + const QString theme = name(); + return theme.compare(style, Qt::CaseInsensitive) == 0; +} + QString QQuickStylePlugin::name() const { return QString(); |