QT5 based KDE applications don't appear correctly in alternative WMs..

J

JasKinasis

Guest
This isn't a question thread.. This is more of a heads up on an issue I've discovered with QT5 based applications when using alternative WM's and some potential fixes/workarounds I found (after much searching!).

Basically, if you use an alternative WM/Desktop (other than KDE or GNOME) - like dwm for example, which is what I use. QT5 based applications will not display correctly (if at all!)

Here's my story:
I finally decided to upgrade my laptop from Kubuntu 14.04 LTS, which had been installed since shortly after 14.04 was released. Rather than upgrading to Kubuntu 16.04 LTS, I decided to install Debian via the Debian minimal net install.

After installing Debian stable, I set apt to use Debians testing repos and upgraded the system to get all of the latest packages from testing. Then I set about installing the latest QT5 based version of KDE/plasma and all of my most commonly used programs, dev-tools (gcc, autotools, cmake etc), libraries, etc, etc, ad-nauseum.

After restoring all of my personal files from backups (including dotfiles for vim, tmux etc.) it was time to install my favourite alternative WM - dwm (Dynamic Window Manager). dwm is a tiling window manager that I have been using on all of my Linux installs for many, many years now. It is by far my favourite environment to use when logged into my machine!

Rather than using Debians pre-packaged versions of dwm (not to mention dmenu and the other suckless tools) - I used the latest versions from git, with some of my own patches applied. Nothing too fancy, just my preferred colour-scheme and some custom key-binds to quickly start some of my favourite applications.

dwm and the other suckless tools all built and installed OK. I added a dwm.desktop file to start a new Xsession. Finally I was ready to reboot the system and try out my shiny new desktops.

After a reboot, I logged into KDE/Plasma - Some interesting changes from 4.x (which was installed on Kubuntu 14.04). Had a little explore and set up some of my preferences and themes. Took a look at Dolphin and a few other apps and changed some of my preferences there. Everything is great so far!

Finally, I log out and log into a dwm session.
I open up a few terminals - everything looks OK. I open up tmux and find that my personal config for tmux needs to be updated. Some of the options used in my old config no longer exist.. That takes less than a minute to fix.. A quick look at the man-page and a bit of vim soon fixes that!

Next I test the rest of my custom keybinds for firing up some of my most used appications - first up Okular (KDE's e-reader) - Loads OK, looks fine...
Fire up another keybind - Dolphin - dolphin5 appears on-screen, but all of the icons are missing.
Take a look at systemsettings (KDE's settings program) - No icons - OK, something is definitely not right here.
Libreoffice, Gimp, Scribus - all work fine.
Back to Dolphin - no icons....
Back to systemsettings - no icons...
Back to Okular - Looks fine. But after looking in the help->about section in Okular, I can see that the installed version of Okular is QT4 based.... So it seems that QT5 applications are the problem....

Log out and back into KDE - open Dolphin and a few other programs - everything appears exactly as it should.
Log out and back into dwm - open Dolphin and systemsettings - no icons.... Hmmm....Perplexing....

So I hit duckduckgo with a few searches. Initially I found nothing that would help.
After refining the wording of my search I finally found this on the Arch wiki, which describes my problem, it's cause and lists some potential fixes for the issue - Good old Arch!:

https://wiki.archlinux.org/index.php/Qt#Configuration_of_Qt5_apps_under_environments_other_than_KDE

After following the instructions in the above link and trying a few things out; in order to get the QT5 based applications working on dwm, I ended up having to resort to building and installing the qt5ct program from source (after installing all of it's dependencies) and set an environment variable:
QT_QPA_PLATFORMTHEME="qt5ct"
I added the environment variable in a new file: /etc/X11/Xsession.d/100-qt5ct

After running the qt5ct executable to set my theme preferences for QT5 - I logged out and switched to a fallback tty (using ctrl + alt + F2), logged in and restarted X.
I then switched back to the GUI login screen (ctrl + alt + F7), logged into a dwm session, fired up Dolphin and.... Success!! systemsettings and the other QT5 based applications would run with absolutely no issues too... Problem solved! Phew!

So, if you use an alternative WM/DE and you have problems with QT5 based programs, the answers can be found above! :) The thread on the arch-wiki describes the actual causes of the problem. Essentially, QT5 doesn't have a qtconfig application to configure the look/feel for QT5 apps. Instead, it attempts to use whatever theme engine is installed on the running desktop. But certain DEs/WMs do not have a theme-engine, so setting qt5ct to be the theme engine for QT5 fixes the problem in these environments.

Incidentally, if you need qt5ct and it isn't pre-packaged in any of your distros repos (like Debian), the source code for the qt5ct application can be downloaded from:
https://sourceforge.net/projects/qt5ct/

NOTE: qt5ct requires some qt5 development libraries to be installed as pre-requisites for successful compilation/installation. All pre-requisites are listed in the documentation that ships with the source-code. It's a relatively simple and pain-free process!
 


With the QT5 problem out of the way, I've just got one or two other problems to fix before I can get back to business as usual. A couple of programs I use a lot that aren't currently in Debians testing repos. Namely Rednotebook and Lilypond.... I guess it's time to build and install a few more programs from source!
I'm sure I can live without Rednotebook, but I really NEED Lilypond to turn my Drumburp drum-tabs into beautiful sheet music... :(
 

Members online


Top