┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorChristoph Cullmann <[email protected]>2024-05-12 23:39:31 +0200
committerMéven Car <[email protected]>2024-05-13 09:58:10 +0000
commita55c467fbb31d822d89722812388425327830377 (patch)
tree27247493049e7808fc67550d69bc93b4866e3bcf /src/main.cpp
parentcb75b5a7decfe10cfc26240c1d5bbf65224cf424 (diff)
use proper icon set and style outside of Plasma
the framework functions used will setup the proper icon set and re-coloring and style to use details see https://invent.kde.org/frameworks/kiconthemes/-/issues/3
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 207a12116..6df53b62e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -22,6 +22,7 @@
#include <KCrash>
#include <KDBusService>
#include <KIO/PreviewJob>
+#include <KIconTheme>
#include <KLocalizedString>
#include <KWindowSystem>
@@ -29,6 +30,11 @@
#include <Kdelibs4ConfigMigrator>
#endif
+#define HAVE_STYLE_MANAGER __has_include(<KStyleManager>)
+#if HAVE_STYLE_MANAGER
+#include <KStyleManager>
+#endif
+
#include <QApplication>
#include <QCommandLineParser>
#include <QDBusConnection>
@@ -70,6 +76,13 @@ int main(int argc, char **argv)
#endif
/**
+ * trigger initialisation of proper icon theme
+ */
+#if KICONTHEMES_VERSION >= QT_VERSION_CHECK(6, 3, 0)
+ KIconTheme::initTheme();
+#endif
+
+ /**
* enable high dpi support
*/
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
@@ -79,9 +92,20 @@ int main(int argc, char **argv)
QApplication app(argc, argv);
app.setWindowIcon(QIcon::fromTheme(QStringLiteral("system-file-manager"), app.windowIcon()));
-#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
+#if HAVE_STYLE_MANAGER
+ /**
+ * trigger initialisation of proper application style
+ */
+ KStyleManager::initStyle();
+#else
+ /**
+ * For Windows and macOS: use Breeze if available
+ * Of all tested styles that works the best for us
+ */
+#if defined(Q_OS_MACOS) || defined(Q_OS_WIN)
QApplication::setStyle(QStringLiteral("breeze"));
#endif
+#endif
KCrash::initialize();