Ubuntu – Qt apps are very slow to load in Xubuntu 20.04 when export QT_QPA_PLATFORMTHEME=gtk2 is enabled


I have installed qt5ct to apply gtk2 theme on Qt apps (by default they follow the Fusion theme). However, Qt apps (I have tried GNU Octave and Brightness Controller) are taking too much time to start up when the gtk2 theme is enabled.

For example, Brightness Controller is taking ~25 seconds to load in gtk2 theme in qt5ct, while it takes 1-2 seconds to load under Fusion or any other theme (I have measured this by looking at a watch after clicking the icon).

The same goes for GNU Octave.

How to fix this? Please let me know whether I need to post any logs.

qt5ct itself is also very slow to load.

I have used qt5ct before in previous versions of Xubuntu, and there it was much faster.

Best Answer

The startup speed of qt applications in clean installs of GNOME-based, 19.10+ versions of Ubuntu, its official flavors and derivatives is much longer if one tries to style them to appear consistent with native GNOME applications.


For whatever reason, users who upgrade from 19.04 don't see this problem.

Anyway, one satisfactory workaround is based on using Kvantum. See, for example, Use Custom Themes For Qt Applications (And Fix Qt5 Theme On GNOME) On Linux With Kvantum.

As described in the preceding link, since Kvantum isn't installed by default, it can be installed on 20.04 using

sudo apt install qt5-style-kvantum qt5-style-kvantum-themes

A ppa is available:

sudo add-apt-repository ppa:papirus/papirus
sudo apt update
sudo apt install qt5-style-kvantum qt5-style-kvantum-themes

After that, run

echo "export QT_STYLE_OVERRIDE=kvantum" >> ~/.profile

Log out and log back in. The link also has instructions for using Kvantum system-wide (with export QT_STYLE_OVERRIDE=kvantum in /etc/environment) and for uninstalling it.

Related Question