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++

Remove checks for compatible styles

Halla Rempt650e049ee9a7
diff --git a/libs/ui/KisApplication.cpp b/libs/ui/KisApplication.cpp
index af69a6204a..bad4e3b610 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 5b104b28d6..8bc5f9f7ae 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()