[education/kwordquiz] /: Use KirigamiAppDefaults for style selection and other initialization in main()
Arjen Hiemstra <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 1b7116c314637fa45226e05d29a799ff30dd0312 by Arjen Hiemstra.
Committed on 30/07/2026 at 14:07.
Pushed by tfella into branch 'master'.
Use KirigamiAppDefaults for style selection and other initialization in main()
We now have a shared function for this, so use it to reduce code
duplication and handle some cases better.
M +1 -1 CMakeLists.txt
M +1 -0 src/CMakeLists.txt
M +3 -11 src/main.cpp
https://invent.kde.org/education/kwordquiz/-/commit/1b7116c314637fa45226e05d29a799ff30dd0312
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 354087b8..5fd95cd7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -72,7 +72,7 @@ set_package_properties(KF6DocTools PROPERTIES DESCRIPTION
TYPE OPTIONAL
)
-find_package(KF6KirigamiAddons 0.11.0)
+find_package(KF6KirigamiAddons 1.12.0)
set_package_properties(KF6KirigamiAddons PROPERTIES
TYPE REQUIRED
PURPOSE "Kirigami addons application UI framework"
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a9f3f735..9fd2c68d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -72,6 +72,7 @@ target_link_libraries(kwordquiz PRIVATE
KF6::I18n
KF6::NewStuffCore
KF6::DBusAddons
+ KirigamiApp
LibKEduVocDocumentImport__KEduVocDocument
)
diff --git a/src/main.cpp b/src/main.cpp
index 49089d2c..7380d602 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -16,6 +16,7 @@
#include <KAboutData>
#include <KCrash>
#include <KLocalizedString>
+#include <KirigamiAddons/App/KirigamiAppDefaults>
#include <qstringliteral.h>
#if KI18N_VERSION >= QT_VERSION_CHECK(6, 8, 0)
@@ -71,16 +72,13 @@ int main(int argc, char *argv[])
{
#ifdef Q_OS_ANDROID
QGuiApplication app(argc, argv);
- QQuickStyle::setStyle(u"org.kde.breeze"_s);
QIcon::setThemeName(u"tokodon"_s);
#else
QApplication app(argc, argv);
- // Default to org.kde.desktop style unless the user forces another style
- if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) {
- QQuickStyle::setStyle(u"org.kde.desktop"_s);
- }
#endif
+ KirigamiAppDefaults::apply(&app);
+
KLocalizedString::setApplicationDomain(QByteArrayLiteral("kwordquiz"));
QIcon::setFallbackThemeName(u"breeze"_s);
@@ -105,12 +103,6 @@ int main(int argc, char *argv[])
KDBusService service(KDBusService::Unique);
#endif
- KCrash::initialize();
-
-#ifdef Q_OS_WIN
- QApplication::setStyle(QStringLiteral("breeze"));
-#endif
-
QCommandLineParser parser;
aboutData.setupCommandLine(&parser);