You are not logged in.

#1 2025-10-14 12:19:43

TheBigBadBot
Member
Registered: 2022-12-15
Posts: 8

[Solved] Qt apps not using GTK3 theme from QT_QPA_PLATFORMTHEME=gtk3

[Solved] Edit: the solution for now is to use QT_QPA_PLATFORMTHEME=gtk2 with the AUR packages qt6gtk2 & qt5-styleplugins. This is an alternate solution, not a fix of the problem. I wish I was able to get a uniform QT/GTK look without additional AUR packages.

Hello!
I recently configured my system to have a uniform look in all GTK and Qt versions. So I read https://wiki.archlinux.org/title/Unifor … QGtk3Style and managed to get the same working theme for GTK2, GTK3, GTK4, and Qt6 thanks to the env variable QT_QPA_PLATFORMTHEME=gtk3. It is a custom dark theme I installed manually in /usr/share/themes : https://github.com/dracula/gtk.

Unfortunately, for some reason, Qt5 does not follow. Instead, it is showing the default light/white theme. Tested with 3 different Qt5 applications. This is all the output of e.g. Picard:

$ picard 
pci id for fd 30: 10de:2520, driver (null)
pci id for fd 31: 10de:2520, driver (null)
pci id for fd 32: 10de:2520, driver (null)
glx: failed to create dri3 screen
failed to load driver: nvidia-drm

or the output of SVPManager:

$ SVPManager
[...]
14:02:54.371 [I]: Main: using Qt 5.15.17 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 15.2.1 20250813)
[...]
14:02:54.400 [I]: Video: reading OpenCL info...
14:02:54.401 [W]: Video: zero number of OpenCL platforms.
[...]
qt.svg: 14:02:54.603 [W]: :/res/images/fullscreen-off.svg:23:32: Could not parse node: radialGradient
qt.svg: 14:02:54.603 [W]: :/res/images/lights-off.svg:23:32: Could not parse node: radialGradient
pci id for fd 40: 10de:2520, driver (null)
pci id for fd 41: 10de:2520, driver (null)
pci id for fd 42: 10de:2520, driver (null)
glx: failed to create dri3 screen
failed to load driver: nvidia-drm
14:02:54.658 [I]: Main: initialization completed in 279 ms

All the applications works fine, just without the expected theme. The wiki says qt5-base should be at least 5.7.0, mine is 5.15.17+kde+r123-2 so it should be fine.
From now, I don't really now where to look at to find the real issue (and therefore, I don't know how to solve this).
The package qt5gtk2 from the AUR works well, but then Qt6 apps do not follow my theme because I need to set QT_QPA_PLATFORMTHEME=qt5gtk2.
If possible, I would like to not use qt5gtk2 or any additional package.

Thank you for your time and help!

Last edited by TheBigBadBot (Yesterday 08:27:25)

Offline

#2 2025-10-14 12:46:43

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 69,056

Re: [Solved] Qt apps not using GTK3 theme from QT_QPA_PLATFORMTHEME=gtk3

stat /usr/lib/qt/plugins/platformthemes/libqgtk3.so
QT_QPA_PLATFORMTHEME=gtk3 strace -o /tmp/picard.strace picard
cat /tmp/picard.strace | curl -F 'file=@-' 0x0.st
glx: failed to create dri3 screen
failed to load driver: nvidia-drm

looks a bit troublesome, please post your Xorg log, https://wiki.archlinux.org/title/Xorg#General

Offline

#3 2025-10-14 13:28:24

TheBigBadBot
Member
Registered: 2022-12-15
Posts: 8

Re: [Solved] Qt apps not using GTK3 theme from QT_QPA_PLATFORMTHEME=gtk3

$ stat /usr/lib/qt/plugins/platformthemes/libqgtk3.so
  File: /usr/lib/qt/plugins/platformthemes/libqgtk3.so
  Size: 239712    	Blocks: 472        IO Block: 4096   regular file
Device: 259,5	Inode: 7489162     Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2025-10-14 11:38:56.441580913 +0200
Modify: 2025-09-09 13:39:56.000000000 +0200
Change: 2025-09-10 00:14:50.210222469 +0200
 Birth: 2025-09-10 00:14:50.210222469 +0200

strace log: https://0x0.st/KSua.txt
/var/log/Xorg.0.log: https://0x0.st/KSuQ.txt. I have no Xorg log in ~/.local/share/xorg

I don't really understand that much the first log, but perhaps the problem is here?

newfstatat(AT_FDCWD, "/usr/bin", {st_mode=S_IFDIR|0755, st_size=135168, ...}, 0) = 0
newfstatat(AT_FDCWD, "/usr/lib/python3.13", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0
newfstatat(AT_FDCWD, "/usr/lib/python3.13/lib-dynload", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0
newfstatat(AT_FDCWD, "/usr/lib/python3.13/site-packages", {st_mode=S_IFDIR|0755, st_size=20480, ...}, 0) = 0
newfstatat(AT_FDCWD, "/usr/lib/python3.13/site-packages/PyQt5/__init__.cpython-313-x86_64-linux-gnu.so", 0x7ffd5174f490, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib/python3.13/site-packages/PyQt5/__init__.abi3.so", 0x7ffd5174f490, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib/python3.13/site-packages/PyQt5/__init__.so", 0x7ffd5174f490, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib/python3.13/site-packages/PyQt5/__init__.py", {st_mode=S_IFREG|0644, st_size=960, ...}, 0) = 0
newfstatat(AT_FDCWD, "/usr/lib/python3.13/site-packages/PyQt5/__init__.py", {st_mode=S_IFREG|0644, st_size=960, ...}, 0) = 0
openat(AT_FDCWD, "/usr/lib/python3.13/site-packages/PyQt5/__pycache__/__init__.cpython-313.pyc", O_RDONLY|O_CLOEXEC) = 3

I have python-pyqt5 installed, and I don't know if the "No such file" errors are problematic or not.

Offline

#4 2025-10-14 13:31:46

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 69,056

Re: [Solved] Qt apps not using GTK3 theme from QT_QPA_PLATFORMTHEME=gtk3

[     7.439] (II) intel(0): Using Kernel Mode Setting driver: i915, version 1.6.0 0
[     7.558] (II) intel(0): [DRI2]   DRI driver: i965
[     7.606] (EE) AIGLX error: dlopen of /usr/lib/dri/i965_dri.so failed (/usr/lib/dri/i965_dri.so: cannot open shared object file: No such file or directory)
[     7.606] (EE) AIGLX error: unable to load driver i965
[     7.752] (II) IGLX: Loaded and initialized swrast
[     7.752] (II) GLX: Initialized DRISWRAST GL provider for screen 0

remove xf86-video-intel (and all configs referencing it, looks like you're using optimus manager) while I'm reading your strace.

grep -ri intel /{etc,usr/share}/X11/xorg.conf*

Edit

access("/usr/share/gtk-3.0/settings.ini", F_OK) = 0
openat(AT_FDCWD, "/usr/share/gtk-3.0/settings.ini", O_RDONLY|O_CLOEXEC) = 8
access("/etc/gtk-3.0/settings.ini", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/xdg/gtk-3.0/settings.ini", F_OK) = -1 ENOENT (No such file or directory)
access("/home/clement_smagghe/.config/gtk-3.0/settings.ini", F_OK) = 0
openat(AT_FDCWD, "/home/clement_smagghe/.config/gtk-3.0/settings.ini", O_RDONLY|O_CLOEXEC) = 8
newfstatat(AT_FDCWD, "/home/clement_smagghe/.config/gtk-3.0/gtk.css", 0x7ffd5174ed50, 0) = -1 ENOENT (No such file or directory)
access("/home/clement_smagghe/.local/share/themes/gtk-master/gtk-3.24/gtk-dark.css", F_OK) = -1 ENOENT (No such file or directory)
access("/home/clement_smagghe/.local/share/themes/gtk-master/gtk-3.22/gtk-dark.css", F_OK) = -1 ENOENT (No such file or directory)
access("/home/clement_smagghe/.local/share/themes/gtk-master/gtk-3.20/gtk-dark.css", F_OK) = -1 ENOENT (No such file or directory)
access("/home/clement_smagghe/.local/share/themes/gtk-master/gtk-3.18/gtk-dark.css", F_OK) = -1 ENOENT (No such file or directory)
access("/home/clement_smagghe/.local/share/themes/gtk-master/gtk-3.16/gtk-dark.css", F_OK) = -1 ENOENT (No such file or directory)
access("/home/clement_smagghe/.local/share/themes/gtk-master/gtk-3.14/gtk-dark.css", F_OK) = -1 ENOENT (No such file or directory)
access("/home/clement_smagghe/.local/share/themes/gtk-master/gtk-3.0/gtk-dark.css", F_OK) = -1 ENOENT (No such file or directory)
access("/home/clement_smagghe/.themes/gtk-master/gtk-3.24/gtk-dark.css", F_OK) = -1 ENOENT (No such file or directory)
access("/home/clement_smagghe/.themes/gtk-master/gtk-3.22/gtk-dark.css", F_OK) = -1 ENOENT (No such file or directory)
access("/home/clement_smagghe/.themes/gtk-master/gtk-3.20/gtk-dark.css", F_OK) = -1 ENOENT (No such file or directory)
access("/home/clement_smagghe/.themes/gtk-master/gtk-3.18/gtk-dark.css", F_OK) = -1 ENOENT (No such file or directory)
access("/home/clement_smagghe/.themes/gtk-master/gtk-3.16/gtk-dark.css", F_OK) = -1 ENOENT (No such file or directory)
access("/home/clement_smagghe/.themes/gtk-master/gtk-3.14/gtk-dark.css", F_OK) = -1 ENOENT (No such file or directory)
access("/home/clement_smagghe/.themes/gtk-master/gtk-3.0/gtk-dark.css", F_OK) = -1 ENOENT (No such file or directory)
access("/usr/local/share/themes/gtk-master/gtk-3.24/gtk-dark.css", F_OK) = -1 ENOENT (No such file or directory)
access("/usr/local/share/themes/gtk-master/gtk-3.22/gtk-dark.css", F_OK) = -1 ENOENT (No such file or directory)
access("/usr/local/share/themes/gtk-master/gtk-3.20/gtk-dark.css", F_OK) = -1 ENOENT (No such file or directory)
access("/usr/local/share/themes/gtk-master/gtk-3.18/gtk-dark.css", F_OK) = -1 ENOENT (No such file or directory)
access("/usr/local/share/themes/gtk-master/gtk-3.16/gtk-dark.css", F_OK) = -1 ENOENT (No such file or directory)
access("/usr/local/share/themes/gtk-master/gtk-3.14/gtk-dark.css", F_OK) = -1 ENOENT (No such file or directory)
access("/usr/local/share/themes/gtk-master/gtk-3.0/gtk-dark.css", F_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/themes/gtk-master/gtk-3.24/gtk-dark.css", F_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/themes/gtk-master/gtk-3.22/gtk-dark.css", F_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/themes/gtk-master/gtk-3.20/gtk-dark.css", F_OK) = 0
openat(AT_FDCWD, "/usr/share/themes/gtk-master/gtk-3.20/gtk-dark.css", O_RDONLY|O_CLOEXEC) = 8
access("/usr/share/themes/gtk-master/gtk-3.20/settings.ini", F_OK) = -1 ENOENT (No such file or directory)

The GTK3 platform theme is used and loads gtk and those configs, specifically succeeds on

access("/usr/share/gtk-3.0/settings.ini", F_OK) = 0
openat(AT_FDCWD, "/usr/share/gtk-3.0/settings.ini", O_RDONLY|O_CLOEXEC) = 8
access("/home/clement_smagghe/.config/gtk-3.0/settings.ini", F_OK) = 0
openat(AT_FDCWD, "/home/clement_smagghe/.config/gtk-3.0/settings.ini", O_RDONLY|O_CLOEXEC) = 8
access("/usr/share/themes/gtk-master/gtk-3.20/gtk-dark.css", F_OK) = 0
openat(AT_FDCWD, "/usr/share/themes/gtk-master/gtk-3.20/gtk-dark.css", O_RDONLY|O_CLOEXEC) = 8

Edit #2: can you post a screenshot of the client and is eg. https://archlinux.org/packages/extra/x86_64/qhexedit2/ affected?

Last edited by seth (2025-10-14 13:39:31)

Offline

#5 2025-10-14 15:16:45

TheBigBadBot
Member
Registered: 2022-12-15
Posts: 8

Re: [Solved] Qt apps not using GTK3 theme from QT_QPA_PLATFORMTHEME=gtk3

remove xf86-video-intel

Why? Sometimes I boot my laptop in 'integrated' mode. Optimus-manager conf says:

# Driver to use for the Intel GPU. Possible values : modesetting, intel
# To use the intel driver, you need to install the package "xf86-video-intel".
driver=intel

The log I created in my previous post was done in 'hybrid' mode, I should look if there is the same error on 'integrated mode' but I doubt. Unless it is related to my issue with GTK/QT themes, I prefer not to touch it for now.

$ grep -ri intel /{etc,usr/share}/X11/xorg.conf*
/etc/X11/xorg.conf.d/10-optimus-manager.conf:	Driver "intel"

Here's a screenshot of MkvToolNix (Qt6) on the left, and Picard (Qt5) on the right. kUvRw14.png
I tried to test qhexedit2, but the package does not have any binary, and requires the user to build the example they give on their GitHub. First time I compile a Qt project, took me quite some time and didn't managed to

$ qmake-qt5 -project
$ qmake-qt5
$ make
g++ -c -pipe -O3 -march=native -pipe -flto -fno-fat-lto-objects -Wall -Wextra -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I. -I. -I/usr/include/qt -I/usr/include/qt/QtGui -I/usr/include/qt/QtCore -I. -I/usr/lib/qt/mkspecs/linux-g++ -o main.o main.cpp
main.cpp:20:10: fatal error: QApplication: No such file or directory
   20 | #include <QApplication>
      |          ^~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:526: main.o] Error 1

Even if I have the 'qwt' package, it does not find automatically the lib to include so I need to manually add an `-I` argument to the different g++ commands, and then I got other errors and finally gave up (they try to `#include "ui_optionsdialog.h"` but that file does not exist in their repo...).

Offline

#6 2025-10-14 15:34:45

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 69,056

Re: [Solved] Qt apps not using GTK3 theme from QT_QPA_PLATFORMTHEME=gtk3

Because the driver is unmaintained and would require special configuration to work w/ iris chips itfp and as result you're currently running a software emulation.

Sorry, I was  just looking for some basic qt5 client that's not likely to be using stylesheets.
The include dirs lack /usr/include/qt/QtWidgets - despite https://github.com/Simsys/qhexedit2/blo … dit.pro#L2

Offline

#7 2025-10-14 17:13:15

TheBigBadBot
Member
Registered: 2022-12-15
Posts: 8

Re: [Solved] Qt apps not using GTK3 theme from QT_QPA_PLATFORMTHEME=gtk3

Oh ok thanks. So I guess I should change optimus-manager's config to use 'modesetting' for integrated mode then(?).

And yes I needed to add manually `-I/usr/include/qt/QtWidgets` argument to the different g++ commands (as I said), but in the end I still got another error, when they include a file that does not exist on their repo (ui_optionsdialog.h).

Offline

#8 2025-10-14 17:59:58

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 24,798

Re: [Solved] Qt apps not using GTK3 theme from QT_QPA_PLATFORMTHEME=gtk3

You have an Ampere chip and a sufficiently new iGPU you don't need optimus-manager at all and could just opt for: https://wiki.archlinux.org/title/PRIME# … er_offload

Offline

#9 2025-10-14 18:17:47

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 69,056

Re: [Solved] Qt apps not using GTK3 theme from QT_QPA_PLATFORMTHEME=gtk3

but in the end I still got another error, when they include a file that does not exist on their repo (ui_optionsdialog.h).

I can't help you w/ that w/o seeing the error but since it's really just about testing a basic client that's not overly suspicious to qstylesheet abuse, any basic Qt5 client will do.

Looking at your screenshot, the left looks like it's a dark-themed Qt Fusion style anyway, so maybe just opt for that instead having to deal w/ the GTK thing?
(gtk is/was notoriously bad w/ bright on dark because of derived widgets, so maybe the Qt gtk style is also just downforcing this for that reason)

Offline

#10 2025-10-14 22:57:24

TheBigBadBot
Member
Registered: 2022-12-15
Posts: 8

Re: [Solved] Qt apps not using GTK3 theme from QT_QPA_PLATFORMTHEME=gtk3

V1del wrote:

You have an Ampere chip and a sufficiently new iGPU you don't need optimus-manager at all and could just opt for: https://wiki.archlinux.org/title/PRIME# … er_offload

Thanks, I'll into it. I kinda liked having 3 different GRUB boot entries with integrated/hybrid/nvidia modes though ^^

seth wrote:

the left looks like it's a dark-themed Qt Fusion style anyway, so maybe just opt for that instead having to deal w/ the GTK thing?

Ohhhhhh you're right about the fact that it's a dark-themed Qt theme. I was fooled by the fact it was black just as the GTK theme (and unsetting QT_QPA_PLATFORMTHEME would render Qt6 apps in light theme).

Of course I still want to use the same theme between QT and GTK, and because setting 'QT_QPA_PLATFORMTHEME=gtk3' does not work in my case (I wonder if it works for anyone...), I search another solution. And I just tried using qt5gtk2 and qt6gtk2 AUR packages, and they work perfectly (thanks to that, I saw that indeed the Qt6 app in the previous screenshot was *not* using a GTK style). BUT, is there a way to make Qt6 apps use qt6gtk2 and Qt5 apps qt5gtk2 themes automatically? Something like QT_QPA_PLATFORMTHEME=qt5gtk2,qt6gtk2, or maybe QT5_QPA_PLATFORMTHEME & QT6_QPA_PLATFORMTHEME... I am searching for a way to write that in /etc/environment, so I can "forget" about it (I don't really want to remember which apps are Qt5 and to run them manually with the env variable...).

Edit:
I finally managed to use the exact same themes across GTK2/3/4 and Qt5/6. I needed both packages qt6gtk2 and qt5-styleplugins, and to use QT_QPA_PLATFORMTHEME=gtk2, and voilà! A single environment variable with a single value, working for both Qt5 and Qt6 (and this time it correctly sets the entire theme, including fonts, buttons, ...).
- Please still answer to the question before my edit (tl;dr is there a way to use different theme names for Qt5 & Qt6, without editing on a per-app basis?)
- For some reason qt5gtk2 does NOT provide the 'gtk2' theme (only 'qt5gtk2'), while qt6gtk2 does. That's why I needed qt5-styleplugins. I did not expected this.
- Well, the problem is now solved, but now the drawback is to rebuild these packages each time Qt updates...

Last edited by TheBigBadBot (2025-10-14 23:44:45)

Offline

#11 Yesterday 07:29:00

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 69,056

Re: [Solved] Qt apps not using GTK3 theme from QT_QPA_PLATFORMTHEME=gtk3

For reference, https://wiki.archlinux.org/title/Unifor … QGtk3Style

but now the drawback is to rebuild these packages each time Qt updates...

Probably not, certainly not for Qt5 (which is EOL) and generally Qt is way more ABI controlled than, let's say "other toolkits"

Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Offline

Board footer

Powered by FluxBB