Xubuntu - Fix the QT_QPA_PLATFORMTHEME environment variable is not set correctly error

A short while back, I upgraded the minimal installation of Xubuntu Jammy Jellyfish to Noble Numbat, and then I installed Qt5 Configuration Utility (qt5ct) and upon launching, it presented me with the following error,

the QT_QPA_PLATFORMTHEME environment variable is not set correctly (current value:gtk2, required value:qt5ct)

So, I added the following line into the /etc/environment file,

export QT_QPA_PLATFORMTHEME=qt5ct

Next I performed the logout/login routine and again launched the qt5ct and again the same error persisted to my frustration.

A slight digging in the internet dirt made me realize that in the /etc/X11/Xsession.d/56xubuntu-session file, there is a line,

export export QT_QPA_PLATFORMTHEME=gtk2

And, that very line is the reason for the whole issue. The solution is simple; just change that line above to,

export QT_QPA_PLATFORMTHEME=qt5ct

And we are done with it. Do the logout/login thing and this time the qt5ct should launch without any errors, and you should be able to theme your QT based applications.

Adios for now.

Qt5 Configuration Utility

Image courtesy the qt5ct project

 Date: July 5, 2024
 Tags:  how-to linux
 Comments: 

I don't have comments on this blog as they not only are difficult to manage, but are also prone to privacy and security risks.
Instead of leaving a comment, you could email me directly.

 Support: 

Liked what you just read? Please consider buying me a cup of coffee!

Previous:
⏪ A great local shoe store experience in Navsari

Next:
ALT Linux - How to replace PulseAudio with PipeWire ⏩