[graphics/krita] libs/ui: Remove checks for compatible styles

Dmitry Kazakov <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 650e049ee9a7f41afb4df7441fcea241addcc22d by Dmitry Kazakov, on behalf of Halla Rempt.
Committed on 17/07/2026 at 11:35.
Pushed by dkazakov into branch 'master'.

Remove checks for compatible styles

This is only relevant for distribution linux builds: users can
now select all installed styles whether they are funtional or not.

Our own builds (windows, macos, appimage) come with just our selected
set of styles (fusion, macintosh) and new styles cannot be added
to these builds.

On Android, there is no style menu.

M  +13   -37   libs/ui/KisApplication.cpp
M  +4    -19   libs/ui/KisMainWindow.cpp

https://invent.kde.org/graphics/krita/-/commit/650e049ee9a7f41afb4df7441fcea241addcc22d

diff --git a/libs/ui/KisApplication.cpp b/libs/ui/KisApplication.cpp
index af69a6204a5..bad4e3b610f 100644
--- a/libs/ui/KisApplication.cpp
+++ b/libs/ui/KisApplication.cpp
@@ -242,46 +242,22 @@ KisApplication::KisApplication(const QString &key, int &argc, char **argv)
     setWindowIcon(KisIconUtils::loadIcon("krita-branding"));
 #endif
 
-    if (qgetenv("KRITA_NO_STYLE_OVERRIDE").isEmpty()) {
-
-#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
-        QStringList styles = QStringList() << "haiku" << "macintosh" << "breeze" << "fusion";
-#else
-        QStringList styles = QStringList() << "haiku" << "macos" << "breeze" << "fusion";
-#endif
-        if (!styles.contains(style()->objectName().toLower())) {
-            Q_FOREACH (const QString & style, styles) {
-                if (!setStyle(style)) {
-                    qDebug() << "No" << style << "available.";
-                }
-                else {
-                    qDebug() << "Set style" << style;
-                    break;
-                }
-            }
-        }
-
-        // if style is set from config, try to load that
-        KisConfig cfg(true);
-        QString widgetStyleFromConfig = cfg.widgetStyle();
-        if(widgetStyleFromConfig != "") {
-            qApp->setStyle(widgetStyleFromConfig);
+           // if style is set from config, try to load that
+    KisConfig cfg(true);
+    QString widgetStyleFromConfig = cfg.widgetStyle();
+    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
-            qApp->setStyle("fusion");
-        }
-#else
-        } else if (style()->objectName().toLower() == "macos") {
-            // if no configured style on macOS, default to Fusion
-            qApp->setStyle("fusion");
-        }
-#endif
-
+    } else if (style()->objectName().toLower() == "macintosh") {
+         // if no configured style on macOS, default to Fusion
+        qApp->setStyle("fusion");
     }
-    else {
-        qDebug() << "Style override disabled, using" << style()->objectName();
+#else
+    } else if (style()->objectName().toLower() == "macos") {
+        // if no configured style on macOS, default to Fusion
+        qApp->setStyle("fusion");
     }
+#endif
 
     /**
      * Load platform plugin for modifiers fetching
diff --git a/libs/ui/KisMainWindow.cpp b/libs/ui/KisMainWindow.cpp
index 5b104b28d64..8bc5f9f7ae5 100644
--- a/libs/ui/KisMainWindow.cpp
+++ b/libs/ui/KisMainWindow.cpp
@@ -441,34 +441,19 @@ KisMainWindow::KisMainWindow(QUuid uuid)
     d->styleActions = new QActionGroup(this);
     QAction * action;
 
-#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
-    QStringList allowableStyles = QStringList() << "macintosh" << "breeze" << "fusion";
-#else
-    QStringList allowableStyles = QStringList() << "macos" << "breeze" << "fusion";
-#endif
+#ifndef Q_OS_ANDROID
 
     Q_FOREACH (QString styleName, QStyleFactory::keys()) {
-#ifdef Q_OS_ANDROID
-        // disable the style for android platform
-        if (styleName.toLower().contains("android")) {
-            continue;
-        }
-#endif
-        if (qgetenv("KRITA_NO_STYLE_OVERRIDE").isEmpty()) {
-            if (!allowableStyles.contains(styleName.toLower())) {
-                continue;
-            }
-        }
+
         action = new QAction(styleName, d->styleActions);
         action->setCheckable(true);
         d->actionMap.insert(styleName, action);
         d->styleMenu->addAction(d->actionMap.value(styleName));
     }
 
-
     // select the config value, or the current style if that does not exist
     QString styleFromConfig = cfg.widgetStyle().toLower();
-    QString styleToSelect = styleFromConfig == "" ? style()->objectName().toLower() : styleFromConfig;
+    QString styleToSelect = styleFromConfig.isEmpty() ? style()->objectName().toLower() : styleFromConfig;
 
     Q_FOREACH (auto key, d->actionMap.keys()) {
         if(key.toLower() == styleToSelect) { // does the key match selection
@@ -478,7 +463,7 @@ KisMainWindow::KisMainWindow(QUuid uuid)
 
     connect(d->styleActions, SIGNAL(triggered(QAction*)),
             this, SLOT(slotUpdateWidgetStyle()));
-
+#endif
 
     // Load all the actions from the tool plugins
     // ToolBoxDocker needs them when at setViewManager()
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.