Qt is one of the most used toolkit to create cross platform GUI applications. It runs on wide range of hardware platform from embedded devices to modern PC without significant change in the main code.
Qt5 is the latest Qt version, now Qt5 is the de facto standard of Qt based application development, so many Qt4 based applications also ported to Qt5.
Qt4 based application style could be changed easily by qtconfig-qt4 tool, even by editing the Trolltech.conf file, but there is no such utility to change Qt5 theme, change qt5 widget style or fonts style or icon theme.
It's easy to manage Qt5 application style in Qt integrated desktop like KDE, LXQt or Razor-Qt. But a little harder in other desktop like GNOME, Cinnamon, MATE, XFCE or LXDE.
So qt5ct is here to solve the problem, you could use qt5ct to change Qt5 based application style, Qt5 icon theme, Qt5 font style. Even customize the whole widget style with custom Qt style sheet, the qss files.
Qt5ct could use qt5 gtk theme, KDE breeze theme, the fusion theme, QtCurve theme and many more. Each style could be customized further by changing the color schema.
UPDATE: Qt5ct is now available on Ubuntu 18.04 LTS and Debian testing repository.
qt5ct is as easy as running a single line of command.
sudo apt-get install qt5ct
Proper environment variable is automatically exported when X11 session started.
Installing from source code
It's possible to compile it from source, the qt5ct latest source code is available at sourceforge, grab the letest release from there.
I'm here going to install it from source on a Debian testing system. So this compilation guide will be almost same for any Debian derivative including Ubuntu, Linux Mint, Kali Linux etc. etc.
- Installing build time dependencies and header files
sudo apt-get install build-essential qt5-qmake qtchooser qtbase5-dev libqt5svg5-dev libpng12-dev qtbase5-dev-tools qttools5-dev-tools qtbase5-private-dev
- Download the qt5ct source code from the above sorceforge, your download mirror could be different.
wget -c jaist.dl.sourceforge.net/project/qt5ct/qt5ct-0.21.tar.bz2
- Now extract the archive and start building it.
tar -xf qt5ct-0.21.tar.bz2 cd qt5ct-0.21/ QT_SELECT=5 qmake make -j 4 sudo make install
Now installation is finished, give
qt5ct a test run,
cd ~/qt5ct-0.21/ ./test.sh
Qt5ct appearance settings >
Qt5ct Icon theme settnigs >
Testing and setting up qt5ct
To test some Qt5 application with qt5ct rub the application from the command line with the QT_QPA_PLATFORMTHEME environment variable. First run qt5ct and then start the Qt5 application of your choice
EasyPaint is a simple Qt5 based image editor. Now change widget style, font style, icon theme etc. etc. by the qt5ct tool. If it is working make it permanent by exporting the correct environment variable when starting a X11 session.
Crete a file 100-qt5ct under the
/etc/X11/Xsession.d/ folder with your favorite text editor
sudo nano /etc/X11/Xsession.d/101-qt
and put the configuration bellow there.
Now log out and log in again to take the changes effect.
I tested it on Debian stretch(testing), running standalone openbox, compton X11 compositor to fix screen tearing and some Qt based apps, qt5ct working very fine.
It's straight forward to change Qt5 widget style, font style, icon theme with qt5ct. Hope very soon qt5ct will be available in the software repository of all mainline GNU/Linux distributions.
If you have any suggestion or question, just leave a comment, also don't forget to share this with friends.
Hi Arnab for your topic!
I had Linux Mint with Openbox now after QT update nothing is working. I tried all steps according your suggestions but unfortunately when I try to run qt5ct error appears says Could not resolve property : linearGradient4582 and so on a lot of similar errors.
Could you advise how to solve the problem.
Arnab Satapathi says
Daniyar, frankly I don't have any idea what's going on, could you provide a sinppet of the error messages?
It's working fine on my Ubuntu 16.04.4 system, Qt library version is 5.5, it's a bit old though.
Really useful tutorial. So happy my QT apps with XFCE do not look ugly anymore.
On Debian, I had to install qt5-style-plugins package to get GTK2 style choice in qt5ct.
I had an issue with Krusader icons after upgrading to Debian 9 using Gnome desktop. I did not want to install all those *-dev packages on my machine to build qt5ct from source. So I created Bitbucket repository to build qt5ct binary package inside Docker container:
Binary .deb package can be downloaded there. It is also quite easy to produce binaries for other Linuxes - just select different base Docker image (need to fork the repo).
Arnab Satapathi says
Thanks for the tip, it'll be useful for other too.
Krusader 2.7.0 is out, and it improves the situation (icons, etc.) a lot.
John Griessen says
john@toolbench64 [~]sudo apt-get install build-essential qt5-qmake qtchooser qtbase5-dev libqt5svg5-dev libpng12-dev qtbase5-dev-tools qttools5-dev-tools qtbase5-private-dev
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libpng12-dev : Depends: libpng12-0 (= 1.2.50-2+deb8u2) but 1.2.54-4 is to be installed
E: Unable to correct problems, you have held broken packages.
Hi John, thanks for pointing me out, yes I'm running Debian testing, and all packages are meaningful, also tested on Ubuntu 16.04 with qt5ct 0.24 .
I'm done with Debian stable and it's confusing dependency problem.
Yeah, you can export the environment variable from wherever you want 🙂
it works ~/.xinitrc