[multimedia/haruna] src: Don't override the QtQuick style if it's already been set by the QPT

Arjen Hiemstra <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit ea5e7bb272e8c4508daa60d086cb2babc588ee27 by Arjen Hiemstra.
Committed on 30/07/2026 at 09:45.
Pushed by tfella into branch 'master'.

Don't override the QtQuick style if it's already been set by the QPT

The Qt Platform Theme (QPT) may decide to set a different QtQuick style
as default for the platform. Handle that so that QPT style changes are
respected.

M  +8    -4    src/main.cpp

https://invent.kde.org/multimedia/haruna/-/commit/ea5e7bb272e8c4508daa60d086cb2babc588ee27

diff --git a/src/main.cpp b/src/main.cpp
index 6246e95c..4a138490 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -28,6 +28,8 @@
 
 using namespace Qt::StringLiterals;
 
+static const auto INITIAL_STYLE = QQuickStyle::name();
+
 int main(int argc, char *argv[])
 {
 #ifdef QT_DEBUG
@@ -45,15 +47,17 @@ int main(int argc, char *argv[])
     // required by mpv
     QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
 
-    if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) {
-        QQuickStyle::setStyle(u"org.kde.desktop"_s);
-    }
-    QQuickStyle::setFallbackStyle(u"Fusion"_s);
     QIcon::setFallbackThemeName(u"breeze"_s);
 
     QApplication qApplication(argc, argv);
     QApplication::setWindowIcon(QIcon::fromTheme(u"haruna"_s));
 
+    bool handledByQPT = INITIAL_STYLE != QQuickStyle::name();
+    if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE") && !handledByQPT) {
+        QQuickStyle::setStyle(u"org.kde.desktop"_s);
+        QQuickStyle::setFallbackStyle(u"Fusion"_s);
+    }
+
     auto *application = Application::instance();
 
     KDSingleApplication kdsApp;
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.