12

After a fresh installation of Ubuntu Gnome 15.10, Qt apps like qpdfview or QuiteRSS suddenly stopped inheriting the global GTK theme, in my case Numix. The same is also true for the default Adwaita theme, so most likely it's not the theme's fault. It seems, that these apps always use the Cleanlooks Qt theme, regardless of the present GTK theme.

I've never had any problems with theming on previous installations of Ubuntu Gnome.

Installing qt4-qtconfig and playing with different settings (GUI style: default, cleanlooks or gtk+) didn't have any effect on these apps.

Curiously, the qt4-qtconfig app itself is themed properly. So after selecting a different theme, e.g. "desktop settings (default)" or "windows", the theme of this app changes, but not in qpdfview or QuiteRSS. The trick with installing libgnomeui-0 (mentioned here) didn't help either.

Does anyone experience the same and know of a workaround?

1
  • 2
    These might be Qt5 apps. Try installing libqt5libqgtk2 as suggested here. Mar 20 '16 at 2:54
22

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!

4
  • 1
    Excellent!!! Xubuntu LTS should install this library by default! Dec 10 '16 at 15:57
  • This fixed the issue for me in Xubuntu 18.04.1
    – Fibbs
    Dec 2 '18 at 3:19
  • This solution is not recommended on newer systems: github.com/pop-os/pop/issues/712
    – pktiuk
    Jul 11 '20 at 15:32
  • Be sure to restart after installing appmenu-gtk2-module.
    – PJ Singh
    Dec 30 '20 at 20:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.