qt6ct
qt6ct copied to clipboard
Configured theme not applying to all applications
I've used qt5ct and qt6ct to set custom styles for my qt apps, this works great for most apps and I've been using that. But there's a bit of snag, KDE Connect and Tokodon seem to ignore the configured style.
Ark left has the theme applied; whilst Tokodon and KDE Connect fall back to their default light theme.
I have noticed that Kde Connect and Tokodon are a bit different compared to other Qt apps with a header bar and more mobile-forward and responsive layout; but I don't see why they wouldn't be styled by the Qt theme.
I can however confirm that this shouldn't be a configuration issue as both Qt5 and Qt6 applications work fine and without any major issues.
little follow-up that provides more information:
I did some digging and apparently both KDE Connect and Tokodon are built with Kirigami, whatever may be the cause is probably in relation to that. What exactly is at play here, I don't know, but it does seem like a good place to start investigating.
In fact, I found this reddit thread talking about the exact issue at hand; but it doesn't seem to point to anything that could be of use.
KDE uses its own color scheme engine called KColorScheme (ignoring QPalette and Qt theme colors) and Kirigami applications are built on top of QML that qt5ct has no theme control for. The Qt's default for QML applications is the Fusion theme on Linux (just like for widgets) but KDE has its own theme called qqc2-desktop-style that allows applying widgets themes to QML applications. KDE applications are also made for their own icon engine called KIconEngine that applies KDE color schemes to svg icons so when the engine is not used you're likely to see things like black icons on black background.
I have a patch adding KColorScheme/KIconEngine/qqc2-desktop-style support to qt5ct, packages with it are available for NixOS and qt{5,6}ct-kde on AUR.
An important thing is to have a KDE color scheme for your Qt theme and apply it in the patched qt5ct or the result will be screwed as KDE applications use colors from both KDE color schemes and Qt themes. It enumerates such color schemes but doesn't show a difference in preview (as I'm too lazy to implement this, it's good for me as is).
In an ideal world, KDE applications should apply all the custom theming on their own like Qt applications with branded design do on Windows/macOS but it seems there's no people interested in doing such changes in the KDE coomunity.
Kirigami is not the issue, as it also doesn't apply to KDE 6 apps like Dolphin and System Settings using qt6ct.
System Settings do use Kirigami. Although you're right that it's not only Kirigami, it's KColorScheme framework which is used by both QML and Widgets KDE apps.
But does Dolphin use Kirigami? And Haruna? And Amarok git, built with Qt 6? And Okular? Because it doesn't work in those apps either. And if System Settings only partly uses Kirigami, I'd expect the theme to at least partially apply.
Btw, I tried your patch on Arch Linux with qt6ct from git, but it doesn't solve the issue.
As I said, it's not Kirigami but KColorScheme. And yes, all KDE applications use KColorScheme.
Btw, I tried your patch on Arch Linux with qt6ct from git, but it doesn't solve the issue.
Did you choose a color scheme with it that has a (KColorScheme)
in its name?
But then what changed with KDE 6? Because I never had issues like this with KDE 5 apps.
Yes, I chose Breeze Dark. That's one of the two default KDE themes, so it should be good. Except that it isn't.
Yes, I chose Breeze Dark. That's one of the two default KDE themes, so it should be good. Except that it isn't.
Can you provide your Qt-related environment variables? env | grep QT
❯ env | grep QT
QT_AUTO_SCREEN_SCALE_FACTOR=0
QT_WAYLAND_RECONNECT=1
QT_QPA_PLATFORMTHEME=qt6ct
Can you reproduce if you run affected application in that terminal session?
Can you reproduce if you run affected application in that terminal session?
Then it seems to work fine.
Scratch that: it did apply the correct colors, but not the theming engine.
Then it seems to work fine.
So the issue is that you have set QT_QPA_PLATFORMTHEME
in a way it doesn't go through all your graphical session
Then it seems to work fine.
So the issue is that you have set
QT_QPA_PLATFORMTHEME
in a way it doesn't go through all your graphical session
Please see my message after that one. 🙂
(And I have set that variable in /etc/environment, just like I used to do with qt5ct.)
Scratch that: it did apply the correct colors, but not the theming engine.
Some KDE applications like Dolphin hardcode theme for non-KDE sessions now
see https://invent.kde.org/frameworks/kiconthemes/-/issues/3
Scratch that: it did apply the correct colors, but not the theming engine.
Some KDE applications like Dolphin hardcode theme for non-KDE sessions now
But I'm using KDE.
But I'm using KDE.
Then you don't really need qt6ct? Setting qt6ct would make that logic to think you're using a non-KDE session.
But I'm using KDE.
Then you don't really need qt6ct? Setting qt6ct would make that logic to think you're using a non-KDE session.
But using qt6ct I can disable cursor blinking, which is not supported by KDE itself. I was advised to use qt5ct for that on KDE 5, but I clean installed Arch Linux with KDE 6 last week, so now I need to use qt6ct to achieve that. And because of that, I also need to set the theming engine through qt6ct.
That logic seem to force the Qt style from kdeglobals so setting it via both qt6ct and system settings should theoretically do the thing
Could you explain that a bit more? Like I said: I did use this exact same setup with qt5ct without any issues.
Could you explain that a bit more
You don't know how to set Qt style via system settings?
Like I said: I did use this exact same setup with qt5ct without any issues.
As you can see the linked issue in kiconthemes, it's done in KF6, not KF5
I have set it in system settings, but it doesn’t make a difference for the majority of apps, including the ones I listed earlier.
What those commands return?
grep widgetStyle ~/.config/kdeglobals
grep style ~/.config/qt6ct/qt6ct.conf
❯ grep widgetStyle ~/.config/kdeglobals
widgetStyle=qt6ct-style
~
❯ grep style ~/.config/qt6ct/qt6ct.conf
style=kvantum
stylesheets=@Invalid()
toolbutton_style=2
~
❯
Could it be that you have kvantum installed only for Qt 5?
Nope, kvantum-qt6 is installed and qt6ct and FeatherNotes do use the Kvantum theme I set, so it's partly functioning.
The only idea is maybe there's a miscommunication. Can you upload a screenshot of how it looks wrongly and (if possible) how it should look like?
I have no idea what changed, but suddenly it's working now. Thanks for all of your help! 🙂
Actually, scratch that: it works for a moment in for example Dolphin, but when I close Dolphin, it reverts to Breeze. Then I re-apply qt6ct as theme engine in System Settings and Dolphin looks fine again until I close it…