Setting QT5 apps to use GTK theme in Zorin OS

In terminal, download th qt5 plugins:

sudo apt-get install qt5-style-plugins

Once installed, set to your environment:

sudo nano /etc/environment

Tab down to a new line and ctrl+shift+v to paste in this line:
QT_QPA_PLATFORMTHEME=qt5ct
Hit ctrl+x to exit, then hit the y key to say "yes" to save, then hit the enter key to save as current configuration. The terminal will revert to normal. Upon next boot or login, qt5 apps on Zorin should be styled with the gtk theme.

1 Like

Does this fix work on Zorin 16 beta?
Have just tried it and VLC does not follow the dark theme I chose on Zorin.

1 Like

I am glad you asked... I had not tested it. I had set up the fix on Zorin 16, but had not noticed whether it worked. I just tested it- and it does not.

EDIT: I have removed this Kvantum-thing from my computer as noted (LOL) in edits and posts below. /end EDIT

Here is what I found to make qt apps respect gtk themes on Zorin OS 16 (Ubuntu 20.04):
In terminal, install kvantum

sudo apt install qt5-style-kvantum

Once installed, add the qt style to kvantum on your ~/.profile configuration:

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

I tested this and it works on Z16.

And thanks for asking about this in order to get an update. :smiley:

EDIT: I was continuing testing on this and the Zorin Themes are not working. It just so happens that mine does with Kvantum, but no qt apps are honoring any other gtk themes.
Let me keep working on this- Will make a New Post if I find new information.

2 Likes

Do you think we can use something like this?
https://codepre.com/use-kvantum-on-linux-to-use-custom-themes-for-qt-applications-and-fix-qt5-themes-on-gnome.html

Could not find any deb file though.
https://pkgs.org/search/?q=Kvantum-manager

Yes, I already found that the above installs the Kvantum Manager along with the rest above. You can find it in the app menu after installing qt5-style-kvantum.
The problem is;
Kvantum only uses Kvantum-themes. Existing themes can be structured to be used in Kvantum (which falls on the theme developer)... Or modified by the user to be seen by Kvantum. I have been looking into how to do that but it is time consuming and takes some configuring... I am considering instead, looking for a method other than using Kvantum which seems too restrictive to me.

1 Like

Strangely, since starting Kvantum, it is overriding all tooltip backgrounds, too.
It seems that Kvantum can add Kvantum themes and only Kvantum themes to a gtk desktop. Which, in my own opinion, renders it useless on Other Desktops. If some find it acceptable or at least tolerable, to have "less mismatched" qt apps, then that is ok, too.
But now that tooltip popups are blacked out due to Kvantum, I am removing it with cruel prejudice and looking for another solution.

1 Like

Ok... I have finally resolved this on my copy of Zorin OS 16. Perhaps others can relay their experiences with this Fix:

sudo apt install qt5ct

Once installed, open the app and check if it is using your GTK theme. It may not be and if not, there may be a notification bar at the top saying to remove the environment variable.
If so:
Open /home/$USER/.profile (~/.profile)
add the following lines:
export QT_STYLE_OVERRIDE=gtk2
export QT_QPA_PLATFORMTHEME="qt5ct"

Then run qt5ct configuration tool

qt5ct

Under appearance, style select gtk2. Standard Dialogs: GTK2.
Palette: Default

Log out and in - test.
I noticed that qt apps load slower.

Double-post - See above for details on setting qt apps to honor gtk theme directly above this one.

Problem sussed out thanks to qt5ct and kvantum creating a change that revealed a problem in my Theme... Corrected here: