Qt apps stopped inheriting GTK themes

On Ubuntu 17.10 Qt4 apps do inherit the global GTK theme, while Qt5 don't. Since libqt5libqgtk2 isn't available in the official Ubuntu repositories anymore, we have to use another workaround:

Install qt5-style-plugins from the Ubuntu repositories with sudo apt install qt5-style-plugins.

Then add export QT_QPA_PLATFORMTHEME=gtk2 to ~/.profile by echo "export QT_QPA_PLATFORMTHEME=gtk2" >> ~/.profile. This will theme all apps started as user.

If you prefer to apply the theming system-wide (for user and root apps), then use sudo sh -c "echo 'export QT_QPA_PLATFORMTHEME=gtk2' >> /etc/environment".

For Ubuntu 20.04 – 20.10 you have to sudo apt install appmenu-gtk2-module, so that qt apps don't start with a delay. In Ubuntu 21.04 you don't have to install appmenu-gtk2-module any more.

I prefer this method over using kvantum, because with this method also root apps are themed properly and you don't have to adjust the theme in the kvantum manager, to match it your gtk theme.

Reboot and enjoy!