Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Default to Fusion style on Windows

Freya Lupen66b63f2fe4e2
diff --git a/libs/ui/KisApplication.cpp b/libs/ui/KisApplication.cpp
index bad4e3b610..83f65f0423 100644
--- a/libs/ui/KisApplication.cpp
+++ b/libs/ui/KisApplication.cpp
@@ -245,16 +245,17 @@ KisApplication::KisApplication(const QString &key, int &argc, char **argv)
// if style is set from config, try to load that
KisConfig cfg(true);
QString widgetStyleFromConfig = cfg.widgetStyle();
+ QString defaultStyle = style()->objectName().toLower();
if (!widgetStyleFromConfig.isEmpty()) {
qApp->setStyle(widgetStyleFromConfig);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
- } else if (style()->objectName().toLower() == "macintosh") {
- // if no configured style on macOS, default to Fusion
+ } else if (defaultStyle == "macintosh" || defaultStyle == "windowsvista") {
+ // default to Fusion instead of styles that use native theming
qApp->setStyle("fusion");
}
#else
- } else if (style()->objectName().toLower() == "macos") {
- // if no configured style on macOS, default to Fusion
+ } else if (style()->objectName().toLower() == "macos" || defaultStyle == "windowsvista") {
+ // default to Fusion instead of styles that use native theming
qApp->setStyle("fusion");
}
#endif
diff --git a/libs/ui/KisMainWindow.cpp b/libs/ui/KisMainWindow.cpp
index 8bc5f9f7ae..0a86bdca4c 100644
--- a/libs/ui/KisMainWindow.cpp
+++ b/libs/ui/KisMainWindow.cpp
@@ -2556,12 +2556,13 @@ void KisMainWindow::slotUpdateWidgetStyle()
// When switching to a style that uses system colors, reset the theme
#ifndef Q_OS_HAIKU
+ QString currentStyle = qApp->style()->objectName();
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
- if (qApp->style()->objectName() == "macintosh") {
+ if (currentStyle == "macintosh" || currentStyle == "windowsvista") {
d->themeManager->setCurrentTheme("System");
}
#else
- if (qApp->style()->name() == "macos") {
+ if (currentStyle || currentStyle == "windowsvista") {
d->themeManager->setCurrentTheme("System");
}
#endif