diff --git a/kcms/lookandfeel/kcm.cpp b/kcms/lookandfeel/kcm.cpp --- a/kcms/lookandfeel/kcm.cpp +++ b/kcms/lookandfeel/kcm.cpp @@ -40,6 +40,8 @@ #include #include #include +#include +#include #include #include @@ -262,7 +264,12 @@ KConfigGroup cg(conf, "kdeglobals"); cg = KConfigGroup(&cg, "KDE"); if (m_applyWidgetStyle) { - setWidgetStyle(cg.readEntry("widgetStyle", QString())); + QString widgetStyle = cg.readEntry("widgetStyle", QString()); + // Some global themes refer to breeze's widgetStyle with a lowercase b. + if (widgetStyle == QStringLiteral("breeze")) { + widgetStyle = QStringLiteral("Breeze"); + } + setWidgetStyle(widgetStyle); } if (m_applyColors) { @@ -408,10 +415,15 @@ return; } - m_configGroup.writeEntry("widgetStyle", style); - m_configGroup.sync(); - //FIXME: changing style on the fly breaks QQuickWidgets - KGlobalSettings::self()->emitChange(KGlobalSettings::StyleChanged); + // Some global themes use styles that may not be installed. + // Test if style can be installed before updating the config. + QScopedPointer newStyle(QStyleFactory::create(style)); + if (newStyle) { + m_configGroup.writeEntry("widgetStyle", style); + m_configGroup.sync(); + //FIXME: changing style on the fly breaks QQuickWidgets + KGlobalSettings::self()->emitChange(KGlobalSettings::StyleChanged); + } } void KCMLookandFeel::setColors(const QString &scheme, const QString &colorFile)