QT5 configuration - not sure if I have done it correctly?

Show us how you are setting up MX
Message
Author
noesnada
Posts: 65
Joined: Sat Jan 06, 2024 4:04 pm

QT5 configuration - not sure if I have done it correctly?

#1 Post by noesnada »

Hello,

I am new to mxlinux and this is my first question here. Hello to all.

I'm on MXLinux XFCE.

I've setup the qt5ct app on xfce before, but not on mx. In another distro I added a line to /etc/environment, but that did nothing in mx. so I was getting this message at the top of the QT5 settings app (qt5ct).
QT_QPA_PLATFORMTHEME environment variable is not set(required value: qt5ct
So I searched this forum and found a post in which I read that I should take a look at /etc/X11/Xsession.d/56xfce4-qtconfig. So that's what I did.

After having read the contents of that file I created ~/.config/MX-Linux/qt_plugin.conf, pasted

Code: Select all

qt5ct
into it, saved and exited.

Logged out but no change, so back into /etc/X11/Xsession.d/56xfce4-qtconfig. In here I changed the last line of this chunk:

Code: Select all

 #set qt environment variables to follow user chosen platform
      #default plugin is gtk2
      #$HOME/.config/MX-Linux/qt_plugin.conf can hold a user settable value
      file="$HOME/.config/MX-Linux/qt_plugin.conf"
      plugin="gtk2"
to

Code: Select all

 #set qt environment variables to follow user chosen platform
      #default plugin is gtk2
      #$HOME/.config/MX-Linux/qt_plugin.conf can hold a user settable value
      file="$HOME/.config/MX-Linux/qt_plugin.conf"
      plugin="qt5ct"
The only change between the two is in the final line.

After a reboot finally the QT5 app lost the error message and I was able to use kvantum to theme a coupld of kde apps I use.

So at the moment all is well, but I am wondering if I have wrongly configured an important system file that will cause some kind of system breakage after a future update. Or should it be ok? Sorry for the basic question. I am a big fan of linux but not a big expert.

User avatar
dolphin_oracle
Developer
Posts: 22311
Joined: Sun Dec 16, 2007 12:17 pm

Re: QT5 configuration - not sure if I have done it correctly?

#2 Post by dolphin_oracle »

it will be fine, but if we ever update the package that file comes from, you might get asked which you want to keep. the default response will be the version you currently have.

the .config file mentioned should have worked Ok, but its been awhile. that bit of code was for debugging purposes for me, but it should have been valid, assuming there was only one line in the file and no trailing spaces.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.

noesnada
Posts: 65
Joined: Sat Jan 06, 2024 4:04 pm

Re: QT5 configuration - not sure if I have done it correctly?

#3 Post by noesnada »

dolphin_oracle wrote: Sat Jan 06, 2024 5:34 pm it will be fine, but if we ever update the package that file comes from, you might get asked which you want to keep. the default response will be the version you currently have.

the .config file mentioned should have worked Ok, but its been awhile. that bit of code was for debugging purposes for me, but it should have been valid, assuming there was only one line in the file and no trailing spaces.
Many thanks for your quick response.

I was a bit worried I'd maybe set my system up for future breakage. I've been using linux only for about 3 and a half years and still have a LOT to learn.

It sounds like you must be on of the devs, so I'll mention this.. I've been hearing about MX ever since I switched to linux but never installed it until about 3 weeks ago, and I am impressed. I like it. I like all the configuration tools you have added to it.

And the only major DE I had never tried was xfce. I always assumed that it had to stay as ugly as it often looks on defaults, but I was very wrong. It looks great once you mess around with it a bit.

So thanks for your answer to my question, and thanks for MX. :worship:

User avatar
dolphin_oracle
Developer
Posts: 22311
Joined: Sun Dec 16, 2007 12:17 pm

Re: QT5 configuration - not sure if I have done it correctly?

#4 Post by dolphin_oracle »

thanks and welcome to the forum.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.

User avatar
bin
Posts: 68
Joined: Sun Aug 30, 2009 1:53 am

Re: QT5 configuration - not sure if I have done it correctly?

#5 Post by bin »

To run qt5ct you just need to do

Code: Select all

env QT_QPA_PLATFORMTHEME=qt5ct qt5ct
However, if you do not chose gtk2 (the environment variable default) then you need to specify your preference then launching your qt5 app

For example I use XnViewMP.
My preference for appearance is Cleanlooks
So I have a script file called by the .desktop
The script runs

Code: Select all

#!/bin/sh
env QT_QPA_PLATFORMTHEME=cleanlooks "/home/robin/Pictures/XnView/xnview.sh"
xnview.sh is the "executable" for XnViewMP in the .tgz version - I don't use the deb.........none of which is relevant, just sayin'.

noesnada
Posts: 65
Joined: Sat Jan 06, 2024 4:04 pm

Re: QT5 configuration - not sure if I have done it correctly?

#6 Post by noesnada »

Thanks for your post. But it has put me firmly in my place as a linux user with little knowledge. Nearly everything in it talks of things I don't understand.
To run qt5ct you just need to do

Code: Select all

env QT_QPA_PLATFORMTHEME=qt5ct qt5ct
I have just searched up the env command, which I did not know existed, and I see it sets environment variables. But my question is, when you run it, with this being Linux, I gather it puts the output into a file somewhere (that I could edit later if needed - like I believe exportfs does). And if it does create a file, or an entry in a file, that's something I could have done myself manually with touch and nano - yes? I'm asking as so far I'm more comfortable editing files, as I can take note of where they are and return to them if I messed up or need to reverse what I did.

And I am mystified with your script. So much I don't understand. I can see it's a bash script, but don't know what .desktop refers to. It's a hidden file clearly, but where does it live and is it invoked on boot?
After that I can see you are using the env command to do the same thing as mentioned in your first point, but only applying it to xnview. However, how this all works is beyond me. :confused:

User avatar
bin
Posts: 68
Joined: Sun Aug 30, 2009 1:53 am

Re: QT5 configuration - not sure if I have done it correctly?

#7 Post by bin »

Sorry - the use of XnViewMP was just an example of how you could use the same command structure to fine tune whatever you are trying to do.

First of all

Code: Select all

env QT_QPA_PLATFORMTHEME=qt5ct qt5c
simply creates the correct environment for you to be able to configure qt5

Once you have set up to your requirements Appearance, Icons, Fonts you save the configuration.

That is saved to /home/your-username/.config/qt5ct/qt5ct.conf

Don't get worried about the env bit - it just sets the environment for that particular application - in this case qt5ct.

In my example I run XnViewMP with the Cleanlooks theme because it most matches my desktop.

I use the line env QT_QPA_PLATFORMTHEME=cleanlooks in a script to launch the application because otherwise I have to use that command every time I run the program

Provided you have the qt5-style-plugins installed you can fiddle around to your heart's content with this.

Something which may help if you are not sure what is being altered where is this

Code: Select all

find /home/your-username/.config -type f -mmin -1
So this will look in your .config folder for any file changed within the last minute - e.g. qt5ct.conf

Similarly

Code: Select all

sudo find /etc/ -type f -mmin -1
would find any file changed in /etc/ in the last minute - and so on.

Hand editing config files on their own is a lot of fun but done with caution and always a backup copy.

noesnada
Posts: 65
Joined: Sat Jan 06, 2024 4:04 pm

Re: QT5 configuration - not sure if I have done it correctly?

#8 Post by noesnada »

Thank you. I've read that twice already (in order to get it through my head).

I find linux is a never ending voyage of discovery, and the more things I learn the more interesting it gets. But I'm learning very slowly as I use my computer for business and for personal needs, and only search for how something is done, and how it works, when I have a problem. But every reply like yours I receive on a forum adds to the snowball that keeps on rolling downhill and getting a little bit bigger.

Post Reply

Return to “Themes and Screenshots”