3

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.

Archisman Panigrahi
  • 28,338
  • 18
  • 105
  • 212
  • I think Qt apps work best in a Qt desktop environment. The method you describe uses emulation, and it will always make things slower. Have you tried with Lubuntu or Kubuntu? – sudodus Apr 30 '20 at 12:39
  • Well, things like Octave have no GTK equivalent, and some developers use PySide to develop GUIs, which would make it qt. Also, I have used these in Xubuntu 19.10, where this issue was absent. It might have been slower in Xubuntu 19.10, but it was not noticeably slower (eg. here it takes 20+ seconds vs 2 seconds) – Archisman Panigrahi Apr 30 '20 at 12:48
  • Incidentally, when called from menu, Qt apps are following gtk2 theme despite whatever theme is selected in qt5ct, and these are slow. However, when called from terminal, these are following the theme selected in qt5ct and they are fast (unless gtk2 is selected in qt5ct). I have asked this here. https://askubuntu.com/questions/1233431/qt-apps-follow-different-themes-when-called-from-terminal-and-when-run-from-menu – Archisman Panigrahi Apr 30 '20 at 12:51
  • Then you should call this from terminal (maybe via a desktop file, if you like) :-) – sudodus Apr 30 '20 at 12:55
  • I am a co-developer of Brightness Controller. And since this is also present in Octave, this seems to be a bug with either qt or qt5ct or the binding between XFCE's window manager and Qt. Any suggestion where I should report the bug? – Archisman Panigrahi Apr 30 '20 at 12:57
  • Since it depends on how you call the app (via the menu and a desktop file / via the command line), I think it depends on the desktop system so xfce4 or qt5c5. Maybe looking into the Exec line of the desktop file can give you a hint of what happens. For example, you can try exactly that command from a terminal window, and you can try the command line that works, when put into the desktop file. Who decides what the desktop file should contain? Depending on the result you can go ahead in different directions. - Maybe you can report the bug to qt5ct and let that team decide if it is 'their fault'. – sudodus Apr 30 '20 at 14:46
  • See #7 in https://www.linuxuprising.com/2020/04/top-things-to-do-after-installing.html – DK Bose Apr 30 '20 at 16:19
  • Search for "7. Fix Qt5 applications style under GNOME Shell on Ubuntu 20.04" in the linked article. – DK Bose Apr 30 '20 at 16:31
  • @DKBose Yes, it is the same issue. And a bug was reported for 19.10 https://bugs.launchpad.net/ubuntu/+source/qtstyleplugins-src/+bug/1851160, but it is still present in 20.04. I did not experience this bug in 19.10, however I had kubuntu-desktop installed on top of xubuntu. – Archisman Panigrahi Apr 30 '20 at 16:56
  • @DKBose the kvantum solution works, please post it as an answer and I will accept it. – Archisman Panigrahi May 03 '20 at 02:53

1 Answers1

5

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.

See

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.

DK Bose
  • 42,548
  • 23
  • 127
  • 221
  • Using kvantum caused problems on Ubuntu 20.10 with root apps (added it to /etc/environment), this one is a more simple approach that works with user and root apps: https://askubuntu.com/a/748186/79691 – DMT Nov 24 '20 at 15:18
  • This worked for me in Linux Mint 20 Cinnamon. – Kendor Nov 25 '20 at 04:25