Get Qt5 Apps To Use Native Gtk+ Style In Ubuntu

Some Qt5 applications don't use a Gtk+ style by default in Gnome (in Ubuntu 18.04 for example), which makes them look out of place. This includes applications like VirtualBox, VLC, qBittorrent, Simple Screen Recoder, the ownCloud desktop client, and so on.

 This article explains how to fix this and get Qt5 applications to use a Gtk+ 2 style in Debian or Ubuntu (and Linux distributions based on Ubuntu that use a Gnome desktop, like Pop!_OS).
[Edit] For fresh Ubuntu 20.04 and 19.10 installs (this does not happen if you upgrade from an older Ubuntu), using QT_QPA_PLATFORMTHEME=gtk2 slows down launching Qt5 applications quite a lot, so don't use this.


VLC and VirtualBox before and after using the tweak in this article, on Ubuntu 18.04:


>Before:

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFecd-boy3kfjcHTafn-3r-ZUEhKAtNIuFjCPG3pjSFNGacAgGnVX8BDr8IDEFDTeieot7vB3gOnwGK8USM2ibjfqWz3QZN9GsrUWZ8uZfWcuayN156abTMUF2KenbMx3bGucWSo2BQPM/s1600/qt5-nofix-ubuntu1804-virtualbox.png





>After:

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMC3uC06QjIDvVZZEO6Audx2GDpp-cZqCCvP7jxEaBwoJzpTLAWdYJVTOucUalff_YCXKyhqlcn0RSpKW4jxUGRoBlV1ktCLRBRITWzdFO-gLBrrzZDNe6oOv4MR3xtwzAXITsCgKX3ec/s1600/qt-style-fixed-ubuntu1804.png



To fix this issue and get Qt5 applications to use a Gtk+ style, all you have to do is follow the simple steps below.

1. install qt5-style-plugins, a package which contains cleanlooks, Motif, Plastique, and Gtk+ 2 Qt5 styles.


Terminal:
sudo apt install qt5-style-plugins

2. set Qt5 applications to use the Gtk+ 2 style by adding export QT_QPA_PLATFORMTHEME=gtk2 to your ~/.profile. To do this with a simple command, run the following:

Terminal:

echo "export QT_QPA_PLATFORMTHEME=gtk2" >> ~/.profile

Comments

Popular Posts