Can't change QT_QPA_PLATFORMTHEME to anything but qt5ct

Running
OS: Manjaro 20.1 Mikah
Kernel: x86_64 Linux 5.4.64-1-MANJARO
DE: Xfce4

having some minor issues with QT applications when using a dark theme. So I wanted to change the QT_QPA_PLATFORMTHEME to gtk2 - just to check if it makes any difference. So I’ve changed it in /etc/environment, rebooted and checked again - still qt5ct.

My guess is that qt5ct itself sets the environment variable - afterwards. Due to my DE I can’t remove it without loosing some xfce settings from the manjoro team.

Is there a way to change the variable?

Thanks to some answers to my question it could be reduced to:
What overwrites the environment variable QT_QPA_PLATFORMTHEME in manjaro

Did you change it as a superuser?

I also recommend qgnomeplatform installed
and setting

QT_QPA_PLATFORMTHEME=gnome

if you mainly use gtk/gnome environments

1 Like

Also, possible overwrittes can happen at systemd generators

~/.config/environment.d/*.conf 

Sure. You can’t change it otherwise. From what I’ve read (arch forums & wiki) used to be a valid value.
But even it wasn’t: Setting an environment variable should work. (I’ve done that on my arch system without problems)

Question is: why should I install something else if:

  • I can’t find any information about it
  • Is not documented in the arch or manjaro wiki
  • It works on an original arch linux

concerning the environment.d folder in ~/.config: it doesn’t exist.
I guess I’d rather expect an explanation which code overwrites it. (because its not the first environment variable I’ve set - but the only one that seems not to be accepted. So I’m pretty sure it is getting overwritten.

The Desktop Environments ecosystem is not ideal and often very opinionated.

I understand your pain, for example GDM is unsetting my PATHs uppon login. Why the F@@ would it do that?? No idea but some smartasses from Gnome just decided it would be great to unset PATH when logging in.

In your case, some app or some mechanism does set/unset the QT platform variable.

No qt5ct is not run as a service and it’s not touching the variable.

1 Like

Have you checked ~/.profile ?
https://wiki.manjaro.org/index.php?title=Set_all_Qt_app's_to_use_GTK%2B_font_%26_theme_settings

1 Like

Yep - I think so. Question is what or who. Your objection that qt5ct is not a service is right. Since I cant’t remove it, I think that some part of manjaro sets it - because it needs it for the Manjaro Notification Settings. (You can see it on the UI- that is a QT GUI) :wink:

Truth is: I’ve set the variable in bash and changed the variable - no change in a QT UI. So my question boils down to: Who is interfering with environment?

What issues? It’s hard to help when you don’t help us help you. :wink:

No, it doesn’t.

That variable is redundant in Xfce as…

…it’s the default Qt5 style in Cinnamon, GNOME, MATE, LXDE and Xfce

Warning: Depending on GTK 2 theme, this style may cause rendering issues such as transparent fonts or inconsistent widgets.

See: Uniform look for Qt and GTK applications: QGtkStyle

FYI, I have no environment variables set on my netbook with Manjaro Xfce:
GTK theme: Adwaita-maia-dark
Kvantum theme: KvAdwaitaDark
Qt5 Settings Style: kvantum

This is now default in the Manjaro GNOME edition as Qt5ct isn’t seeing much development. It will also work well in Xfce. It will attempt to match Qt applications with the applied GTK theme. If you have Kvantum Manager (kvantum-qt5) installed, it will attempt to match a Kvantum theme.

Apparently you were looking in the wrong places. QGnomePlatform is developed by Fedora and I package it for Manjaro:

It is indeed:
Uniform look for Qt and GTK applications: QGnomePlatform

Well, you have the qt5ct package installed on Manjaro (required by manjaro-xfce-settings) and probably don’t on Arch.

If you want to set any environment variables, here are your options:

QT_QPA_PLATFORMTHEME="<value>"
# qt5ct: requires qt5ct
# gtk2: requires qt5-styleplugins
# gnome: requires qgnomeplatform
# kde

# Only if you want to override what the Platform Theme provides
QT_STYLE_OVERRIDE="<value>"
# Adwaita / Adwaita-Dark: requires qgnomeplatform
# kvantum / kvantum-dark: requires kvantum-qt5
# Windows
# Fusion
2 Likes

But how can he set it? That’s the question. Something somewhere is overwriting his environment.

Maybe that’s the thing?
I recall at first we had to specify environment variables in order to use qt5ct or kvantum. If now such variables aren’t needed, would it mean those utilities are now automatically detected and used – and probably overwriting?

Nevermind about that. I forgot that QT_QPA_PLATFORMTHEME="qt5ct" is set in ~/.profile` by default by one of the Manjaro packages (forgot, too lazy to look).

@Kanehekili Try creating a new user, immediately edit ~/.profile to you liking and see if you can reproduce the issue.

Yep -that’s it. I was wondering who sets it. I’ve never thought about the .profile. Thank you - another riddle solved.

First thanks a lot for the elaborate explanation. And yes- I should’ve been more verbose about my problem:
I’m running xfce but developing and using QT5 applications. Some of the apps show white lines - something that I haven’t observed before. So I wanted to check out if qt5ct is maybe the culprit.

Status Bar has a white frame:

VLC progress bar with a light gray line:

That does not conform to the dark theme (happens also with Adwaita-dark). And I couldn’t find any documentation about this behavior…

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.