[utilities/kalk] /: Use KirigamiAppDefaults for setting the application style and other defaults

Tobias Fella <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit d06b8a995476d5538db9eba70049f3d88fee04d6 by Tobias Fella, on behalf of Arjen Hiemstra.
Committed on 25/07/2026 at 20:36.
Pushed by tfella into branch 'master'.

Use KirigamiAppDefaults for setting the application style and other defaults

We now have a dedicated function that can handle this so let's use that
and reduce code duplication.

M  +1    -0    CMakeLists.txt
M  +1    -0    src/CMakeLists.txt
M  +4    -10   src/main.cpp

https://invent.kde.org/utilities/kalk/-/commit/d06b8a995476d5538db9eba70049f3d88fee04d6

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c2c7f3c..d23ada1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -54,6 +54,7 @@ find_package(KF6 ${KF_MIN_VERSION} REQUIRED COMPONENTS
     Config
     UnitConversion
 )
+find_package(KF6KirigamiAddons REQUIRED CONFIG)
 pkg_search_module(QALCULATE libqalculate>4.7.0 REQUIRED IMPORTED_TARGET)
 if (ANDROID)
     find_package(Qt6 ${QT_MIN_VERSION} REQUIRED COMPONENTS Svg)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6042f42..96edf7e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -56,6 +56,7 @@ target_link_libraries(kalk PRIVATE
     Qt6::QuickControls2
     KF6::I18n
     KF6::CoreAddons
+    KirigamiApp
     kalklib
     kalklibplugin
 )
diff --git a/src/main.cpp b/src/main.cpp
index 6480ba8..09482cb 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -19,6 +19,7 @@
 #include <KAboutData>
 #include <KLocalizedQmlContext>
 #include <KLocalizedString>
+#include <KirigamiAddons/App/KirigamiAppDefaults>
 
 #include "version.h"
 
@@ -33,19 +34,12 @@ int main(int argc, char *argv[])
 
 #ifdef Q_OS_ANDROID
     QGuiApplication app(argc, argv);
-    QQuickStyle::setStyle(QStringLiteral("org.kde.breeze"));
 #else
     QApplication app(argc, argv);
-    // set default style and icon theme
-    QIcon::setFallbackThemeName(QStringLiteral("breeze"));
-    if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) {
-        QQuickStyle::setStyle(QStringLiteral("org.kde.desktop"));
-    }
-    // if using org.kde.desktop, ensure we use kde style if possible
-    if (qEnvironmentVariableIsEmpty("QT_QPA_PLATFORMTHEME")) {
-        qputenv("QT_QPA_PLATFORMTHEME", "kde");
-    }
 #endif
+
+    KirigamiAppDefaults::apply(&app);
+
     QQmlApplicationEngine engine;
     KLocalizedString::setApplicationDomain(QByteArrayLiteral("kalk"));
     parser.addVersionOption();
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.