[utilities/filelight] src: Only set the QtQuick style if it wasn't done by the QPT before

Arjen Hiemstra <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit f36a6a526c0a94b96016f13dafdd2a8b4329bf98 by Arjen Hiemstra.
Committed on 29/07/2026 at 12:47.
Pushed by ahiemstra into branch 'master'.

Only set the QtQuick style if it wasn't done by the QPT before

Rather than just always setting the style if the QT_QUICK_CONTROLS_STYLE
environment variable was not set, copy the logic from
KirigamiAppDefaults of kirigami-addons to check if the style has not
already been set by the QPT. This allows other styles than desktop style
to work if the QPT sets them.

M  +5    -2    src/main.cpp

https://invent.kde.org/utilities/filelight/-/commit/f36a6a526c0a94b96016f13dafdd2a8b4329bf98

diff --git a/src/main.cpp b/src/main.cpp
index bd6ce202..e69331e1 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -34,6 +34,8 @@
 
 using namespace Qt::StringLiterals;
 
+static const auto INITIAL_STYLE = QQuickStyle::name();
+
 int main(int argc, char *argv[])
 {
     // Since filelight may get used when the disk is full or near full we'll not
@@ -56,8 +58,9 @@ int main(int argc, char *argv[])
 
     std::ignore = FileCleaner::instance(); // make sure the cleaner is up and running early so it is definitely up by the time shutdown happens
 
-    if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) {
-        QQuickStyle::setStyle(QStringLiteral("org.kde.desktop"));
+    bool handledByQPT = INITIAL_STYLE != QQuickStyle::name();
+    if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE") && !handledByQPT) {
+        QQuickStyle::setStyle(u"org.kde.desktop"_s);
     }
 
 #if defined(Q_OS_WINDOWS)
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.