Problem with QT apps styling

Hello Forum
It used to work, now it don’t.

What I did so far to make QT apps look the same as GTK apps:

environment.variables = {
  QT_QPA_PLATFORM = "wayland";
  QT_QPA_PLATFORMTHEME="qt5ct";
};

echo $QT_QPA_PLATFORM says wayland
echo $QT_QPA_PLATFORMTHEME says qt5ct

environment.systemPackages = with pkgs; [
  libsForQt5.qt5ct                 # Qt5 Configuration Tool
  adwaita-qt                         # Qt5 themes
  adwaita-qt6
];
qt.enable = true;
qt.platformTheme = "qt5ct";

the app qt5ct says:

The QT_QPA_PLATFORMTHEME environment variable is not set correctly (current value: qt5c, required value: qt5ct).

I use Hyprland as window manager.
The only two QT apps I’m using are CopyQ and KeePassXC

How can I solve this problem? What could possibly be my error?

What alternatives do I have?

looking forward to your answer!

These variables will be set on shell initialisation (e.g. in /etc/profile).

(emphasis mine)

You probably want to use environment.sessionVariables.

1 Like

Thank you NobbZ for the tip.
I changed to environment.sessionVariables, did a sudo nixos-rebuild switch and rebooted.

The error message in qt5ct still persists:

The QT_QPA_PLATFORMTHEME environment variable is not set correctly (current value: qt5c, required value: qt5ct).

How do you start the things that cause the error?

1 Like

with rofi launcher
when I start qt5ct with the terminal it works correctly
when I start KeePassXC with the terminal it’s still the same
when I start qcad with the terminal it wount launch and give me thit error:

QCAD version 3.28.1
18:52:30: Debug: loading plugins…
18:52:30: Debug: loading static plugins…
Warning: Failed to load client buffer integration: “wayland-egl”
Warning: Available client buffer integrations: ()
Warning: No shell integration named “xdg-shell” found
Warning: No shell integration named “xdg-shell-v6” found
Warning: No shell integration named “wl-shell” found
Warning: No shell integration named “ivi-shell” found
Warning: Loading shell integration failed.
Warning: Attempted to load the following shells (“xdg-shell”, “xdg-shell-v6”, “wl-shell”, “ivi-shell”)
18:52:31: Debug: openFiles:
Warning: Wayland does not support QWindow::requestActivate()

hey NobbZ I got it sorted out!

The problem was I specified $QT_QPA_PLATFORMTHEME in tree different places:
in the Hyprland settings
in environment.sessionVariables
and in qt.platformTheme = “qt5ct”

now I only use qt.platformTheme = “qt5ct”; and all is fine again! Phew!

Thank you very much still for helping!

nope, sorry I was cheering to soon. Still not working! It was fine for a moment. All apps I tested worked, but after a reboot, same old!

well, now it’s worky!

Firstly, thanks to NobbZ I changed the environment.variables to environment.sessionVariables which was a bad mistake of mine.
Then I realized that qt.platformTheme = "qt5ct"; didn’t actually set the session variable to qt5ct and that this has to be done separately with environment.sessionVariables.

I guess it has to to with me using the fish shell.

So thank you again NobbZ for your valuable tip!