You are not logged in.
Only working solution in Cinnamon to get GTK theme on Qt:
1) Install qt5-styleplugins or qt5-styleplugins-git
2) Install qt5ct
3) Set environment variable in /etc/environment QT_QPA_PLATFORMTHEME=qt5ct
4) Restart the system
5) Start qt5ct and select gtk2
Just doing QT_STYLE_OVERRIDE=gtk2 caused sigfaults with most Qt apps.
QT_STYLE_OVERRIDE=gtk3 makes Qt apps look horrible.
Last edited by altermetax (2016-06-27 11:44:48)
Offline
Only working solution in Cinnamon to get GTK theme on Qt:
1) Install qt5-styleplugins or qt5-styleplugins-git
2) Install qt5ct
3) Set environment variable in /etc/environment QT_QPA_PLATFORMTHEME=qt5ct
4) Restart the system
5) Start qt5ct and select gtk2Just doing QT_STYLE_OVERRIDE=gtk2 caused sigfaults with most Qt apps.
QT_STYLE_OVERRIDE=gtk3 makes Qt apps look horrible.
You are confused between Qt platform theme and style. Platform theme is responsible for fonts, icon theme, default style, native dialogs and other settings. Style is responsible only for widgets rendering. Qt 5.6 had gtk2 platform theme (which used gtk2 settings) and gtk2 style (which rendered widgets using gtk2). Qt 5.7 has gtk3 platform theme (which uses gtk3 settings), but no gtk3 style. And it is not compatible with gtk2 style (which you can install separately). On Xfce and other DEs Qt automatically loads gtk3 platform theme and if you set QT_STYLE_OVERRIDE=gtk2 Qt apps will segfault. The easiest solution if want to use gtk2 style is using qt5ct platform theme.
1. Install qt5-styleplugins and qt5ct
2. Place "export QT_QPA_PLATFORMTHEME=qt5ct" in ~/.bash_profile
3. Relogin
4. Configure Qt using qt5ct
Keep in mind that you will not have gtk2 file dialogs, because it is what platform theme should do and qt5ct does not have this feature.
Offline
You are confused between Qt platform theme and style. Platform theme is responsible for fonts, icon theme, default style, native dialogs and other settings. Style is responsible only for widgets rendering. […] Qt 5.7 has gtk3 platform theme (which uses gtk3 settings), but no gtk3 style.
All right. So, what if we want gtk3 style as well?
Intel(R) Celeron(R) CPU E3400 @ 2.60GHz, x86_64. AURs.
“No one without the knowledge of geometry may enter.“ Plato.
Offline
Holy crap this is confusing. O_o
My question: What do the Qt developers actually expect people to do? Simply use a native Qt5 theme? That still works, correct?
Offline
Qbittorrent runs for me now (I used the qt5-styleplugins-nogconf-git and the QT_QPA_PLATFORMTHEME=qt5ct method), but it looks far from native. Qt5ct by itself looks exactly as the GTK3 theme I have set, but Qbittorrent itself does not although when I start it from the terminal it says "using qt5ct plugin".
Offline
All right. So, what if we want gtk3 style as well?
You can try to port QGtkStyle to gtk3.
My question: What do the Qt developers actually expect people to do? Simply use a native Qt5 theme? That still works, correct?
I use gtk3 platform theme with Fusion style (this is the default on Xfce and other DEs). I don't care about visual consistency as long as fonts and icons are the same. Also Fusion works a lot faster than QGtkStyle and gtk3 file dialogs are far better than Qt ones.
Offline
Qbittorrent runs for me now (I used the qt5-styleplugins-nogconf-git and the QT_QPA_PLATFORMTHEME=qt5ct method), but it looks far from native. Qt5ct by itself looks exactly as the GTK3 theme I have set, but Qbittorrent itself does not although when I start it from the terminal it says "using qt5ct plugin".
Do you mean that qBittorrent doesn't use gtk2 style? Could you post its screenshot (and qt5ct settings)?
Offline
After update Qt 5.7, QT Apps looks like a sh**
I had in /etc/environment:
QT_STYLE_OVERRIDE=gtk+
Someone have any idea how to repair this?
Before:
http://image.prntscr.com/image/ba1c5c38 … 6a0506.png
After:
http://image.prntscr.com/image/b10313b9aa5a4b5b8afaebd1b34e3097.png
http://image.prntscr.com/image/4e6063df … a844ab.png
Moderator edit [ewaller] Converted oversized images to url links
Last edited by ewaller (2016-06-27 19:45:50)
Offline
After update Qt 5.7, QT Apps looks like a sh**
I had in /etc/environment:
QT_STYLE_OVERRIDE=gtk+Someone have any idea how to repair this?
You don't need QT_STYLE_OVERRIDE=gtk+ for GNOME. Qt 5.6 had to load gtk2 style automatically. However in 5.7 it was removed and for some reason Qt loads windows style (which looks bad) if QT_STYLE_OVERRIDE points to non-existent style. Just remove it from /etc/environment and Qt will use default (Fusion) style. It looks quite good, though does not imitate gtk2 look. If you want to use gtk2 style, follow my instructions couple posts above.
Offline
TheAifam5 wrote:After update Qt 5.7, QT Apps looks like a sh**
I had in /etc/environment:
QT_STYLE_OVERRIDE=gtk+Someone have any idea how to repair this?
You don't need QT_STYLE_OVERRIDE=gtk+ for GNOME. Qt 5.6 had to load gtk2 style automatically. However in 5.7 it was removed and for some reason Qt loads windows style (which looks bad) if QT_STYLE_OVERRIDE points to non-existent style. Just remove it from /etc/environment and Qt will use default (Fusion) style. It looks quite good, though does not imitate gtk2 look. If you want to use gtk2 style, follow my instructions couple posts above.
I have done a clean install just in case I had something wrong in my old install. Discarding any mishaps I could have made along the way. And now it does indeed export the variable. Opening qt programs through any kind of console works flawlessly like before, but it does not through a shorcut, Alt+F2 or something similar in LXDE. Launching through shorcuts is a mixed bag of results. From launching with "Fusion" style, to probably a segfault launching qt5ct (since selecting gtk2 makes it instantly dissapear) Worst case scenario I will be switching every single shorcut for a script so it launches through a console.
Offline
I have done a clean install just in case I had something wrong in my old install. Discarding any mishaps I could have made along the way. And now it does indeed export the variable. Opening qt programs through any kind of console works flawlessly like before, but it does not through a shorcut, Alt+F2 or something similar in LXDE. Launching through shorcuts is a mixed bag of results. From launching with "Fusion" style, to probably a segfault launching qt5ct (since selecting gtk2 makes it instantly dissapear) Worst case scenario I will be switching every single shorcut for a script so it launches through a console.
What QT_* variables do you export? And where are they located?
Offline
.bash_profile
#
# ~/.bash_profile
#
[[ -f ~/.bashrc ]] && . ~/.bashrc
export QT_QPA_PLATFORMTHEME=qt5ct
export QT_PLATFORMTHEME=qt5ct
export QT_PLATFORM_PLUGIN=qt5ct
.pam_environment
QT_QPA_PLATFORMTHEME DEFAULT=qt5ct OVERRIDE=qt5ct
QT_PLATFORMTHEME DEFAULT=qt5ct OVERRIDE=qt5ct
QT_PLATFORM_PLUGIN DEFAULT=qt5ct OVERRIDE=qt5ct
And printenv shows that they are assigned to qt5ct. I did change QT_PLATFORM_PLUGIN, since it defaults to lxqt, and I do not use, nor I installed anything from lxqt this time around. Tried skype too, it defaults to windows and with huge icons. If run through console it runs appropiately but with huge icons.
Offline
hpstg wrote:Qbittorrent runs for me now (I used the qt5-styleplugins-nogconf-git and the QT_QPA_PLATFORMTHEME=qt5ct method), but it looks far from native. Qt5ct by itself looks exactly as the GTK3 theme I have set, but Qbittorrent itself does not although when I start it from the terminal it says "using qt5ct plugin".
Do you mean that qBittorrent doesn't use gtk2 style? Could you post its screenshot (and qt5ct settings)?
Yes, this is exactly what I mean. Let me show you.
Ok, I just found another behavior.
If I open a terminal (with my account, not root) and I start qbittorrent from there, the program doesn't have the proper theme. If I open a terminal again (with my account), runt qt5ct from it, close qt5ct and run qbittorrent from the terminal again, qbittorrent is properly themed.
Here's the terminal output:
If you notice, the second time that qbittorrent runs, I get the message that the custom style sheet has been disabled, and it's then that the application displays properly.
This is my /etc/environment file:
#
# This file is parsed by pam_env module
#
# Syntax: simple "KEY=VAL" pairs on separate lines
#
# Trying to fix QT5 apps under Gnome
#QT_STYLE_OVERRIDE=gtk2
QT_QPA_PLATFORMTHEME=qt5ct
Offline
And printenv shows that they are assigned to qt5ct. I did change QT_PLATFORM_PLUGIN, since it defaults to lxqt, and I do not use, nor I installed anything from lxqt this time around. Tried skype too, it defaults to windows and with huge icons. If run through console it runs appropiately but with huge icons.
You only need QT_QPA_PLATFORMTHEME in .bash_profile or .pam_environment. Try to remove qt5ct settings and select gtk2 style again (after relogin and ensuring that QT_QPA_PLATFORMTHEME is properly exported). Same for hpstg. This is the only advice I can come up with since everything works fine on my system.
Offline
ANXHaruhi wrote:And printenv shows that they are assigned to qt5ct. I did change QT_PLATFORM_PLUGIN, since it defaults to lxqt, and I do not use, nor I installed anything from lxqt this time around. Tried skype too, it defaults to windows and with huge icons. If run through console it runs appropiately but with huge icons.
You only need QT_QPA_PLATFORMTHEME in .bash_profile or .pam_environment. Try to remove qt5ct settings and select gtk2 style again (after relogin and ensuring that QT_QPA_PLATFORMTHEME is properly exported). Same for hpstg. This is the only advice I can come up with since everything works fine on my system.
Yep that works,
On my system that loads using lxdm I needed to set QT_QPA_PLATFORMTHEME=qt5ct in ~/.profile, setting it in ~/.xinitrc didn't worked since it seems lxdm doesn't reads that file... Also the restart is really important, so steps here for XFCE setup using lxdm as display manager:
1. Add 'export QT_QPA_PLATFORMTHEME=qt5ct' to ~/.profile
2. Logout and login
3. Run qt5ct and choose gtk2 in the Style select box and click apply.
4. Run qt5 applications and they should match your theme again.
Offline
I removed the line from /etc/environment and added it to ~/.pam_environment, deleted the qt5ct configuration, restarted, run qt5ct again. I get the same exact symptoms. Qbittorrent run from the Gnome sidebar has no theme, Qbittorrent run from the command line (I use zsh), has the correct theme.
In essence it's exactly the same behavior as when I used /etc/environment.
Offline
After another reinstall (a few quirks that are not related to this) I do still retain the same behavior. I've traced it as far as I can trace it, and it does get set again back to lxqt after the call "exec /usr/bin/lxsession -s LXDE -e LXDE" in /usr/bin/startlxde by adding a quick and dirty printenv >> /home/user/variables.txt Jumping from there to ~/.cache/lxsession/LXDE/run.log shows that it sets unrelated XDG variables, not a single config file noted there contains any reference to any variable at all or any other file that could possibly lead to the infamous config that switches back the config. I've checked it twice just in case. At this point the only thing I can think of is a weird kink between LXDE and any software that maybe hpstg and I have installed that makes it behave strangely like this. I am 99% sure that just before running lxsession QT_QPA_PLATFORMTHEME is properly exported (unless I made a silly mistake in something as simple as adding a line to a script), and once lxsession runs it resets back to default for no apparent reason in the logs. And when it happens only in LXDE and not on other DE makes more sense where does it happen along the way. Should I report it in Arch bug tracker or upstream? And in an unrelated note, troubleshooting this was more fun than I though it would be, glad I picked Arch and not something easier.
Offline
I experimented a little with the variables.
Running
qbittorrent
from a Gnome Terminal with zsh, runs it with the correct theme.
Running
QT_QPA_PLATFORMTHEME=gtk2 qbittorrent
makes it look like it does when I run it from the Gnome sidebar launcher.
Running
QT_QPA_PLATFORMTHEME=qt5ct qbittorrent
makes it look correct.
The QT_QPA_PLATFORMTHEME=qt5ct is somehow not initialized for the desktop. Having it in ~/.pam_environment or /etc/environment doesn't seem to affect anything other than the launch from the terminal.
Offline
This was a rabbit chase but I finally found it! After downloading the source code and doing some searches, LXDE has QT_PLATFORM_PLUGIN and QT_QPA_PLATFORMPLUGIN value hard coded in lxsession, so no matter if the variable is declared properly, when lxsession starts overwrites the value so it doesn't cascade properly. That leads to the aforementioned behavior where apparently it does not initialize. For those interested is in the lxsession package ~/lxsession/environment.c lines 678-679 No wonder it was not working properly. Time to file a bug report upstream then. Hope it gets fixed promptly.
Offline
This was a rabbit chase but I finally found it! After downloading the source code and doing some searches, LXDE has QT_PLATFORM_PLUGIN and QT_QPA_PLATFORMPLUGIN value hard coded in lxsession, so no matter if the variable is declared properly, when lxsession starts overwrites the value so it doesn't cascade properly. That leads to the aforementioned behavior where apparently it does not initialize. For those interested is in the lxsession package ~/lxsession/environment.c lines 678-679 No wonder it was not working properly. Time to file a bug report upstream then. Hope it gets fixed promptly.
In the interim you could just change the value to the one you need. I.e. grab lxsession from ABS, makepkg -o to get the sources, go in and change the hardcoded value to one that works for you, then makepkg -e. Then youd just need to pacman -U the built package. I do this to eliminate window hints from xfce4 terminal.
But yeah, that definitely shouldnt be hardcoded- should pull the value from /etc/environment at the very least.
Last edited by GSF1200S (2016-07-01 11:33:17)
Offline
This was a rabbit chase but I finally found it! After downloading the source code and doing some searches, LXDE has QT_PLATFORM_PLUGIN and QT_QPA_PLATFORMPLUGIN value hard coded in lxsession, so no matter if the variable is declared properly, when lxsession starts overwrites the value so it doesn't cascade properly. That leads to the aforementioned behavior where apparently it does not initialize. For those interested is in the lxsession package ~/lxsession/environment.c lines 678-679 No wonder it was not working properly. Time to file a bug report upstream then. Hope it gets fixed promptly.
Do you believe that something similar might be happening with Gnome? Unfortunately I don't have the expertise to look into the code, I wouldn't even know where to begin.
Offline
I'm having the same problem in Cinnamon. `cinnamon --replace` overwrites QT_STYLE_OVERRIDE with "gtk" (which is revolting IMHO and I want my Fusion back).
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
ANXHaruhi wrote:This was a rabbit chase but I finally found it! After downloading the source code and doing some searches, LXDE has QT_PLATFORM_PLUGIN and QT_QPA_PLATFORMPLUGIN value hard coded in lxsession, so no matter if the variable is declared properly, when lxsession starts overwrites the value so it doesn't cascade properly. That leads to the aforementioned behavior where apparently it does not initialize. For those interested is in the lxsession package ~/lxsession/environment.c lines 678-679 No wonder it was not working properly. Time to file a bug report upstream then. Hope it gets fixed promptly.
Do you believe that something similar might be happening with Gnome? Unfortunately I don't have the expertise to look into the code, I wouldn't even know where to begin.
It may be. At the end of the day I don't know that much (in fact I am using linux seriusly for less than 2 months and the purpose of Arch was learn by doing), I just started pulling from the string "What happens if..." from the login screen until it appears on my screen."What happen if..." "... I use another DE?" It gets exported correctly and works. Let's see how exactly boots LXDE when I press the login button. "... I export the variables just before it starts executing the session?" The variables work, look further down the line. Time to look at the log for LXSession, "... I search for environment, QT and similar keywords, or files loaded through it?" No references, so the answer does have to lie inside LXSession, repeat again, download the sources and do a quick search inside the files with your tool of choice, and the answer appears.
The process should be something similar for GNOME. I don't know how GNOME works, but the logic steps for diagnose should apply pretty much here as well. Start by exporting it properly in your ~/.profile and ~/.pam_environment only, relog and check the output of "printenv | grep QT" in console as normal user. If it shows properly in console but it doesn't open correctly the app, or it doesn't open the app, something is overriding at login your config. Most certainly GNOME or unlikely some other program. To be sure, install something like Openbox, XFCE4 or MATE and boot into it, open a console and check the environment variables again. If it exports them properly it means that it is something specific that loads from GNOME, so you will have to find the login entry point and start cutting the login process in big logic segments. In each segment you will have to either use some relevant log that the desktop makes available or use a script to export the variables before or after the execution of a specific segment of the process until you get the chunk that doesn't load that variable. There will lie the root of the problem.
ANXHaruhi wrote:This was a rabbit chase but I finally found it! After downloading the source code and doing some searches, LXDE has QT_PLATFORM_PLUGIN and QT_QPA_PLATFORMPLUGIN value hard coded in lxsession, so no matter if the variable is declared properly, when lxsession starts overwrites the value so it doesn't cascade properly. That leads to the aforementioned behavior where apparently it does not initialize. For those interested is in the lxsession package ~/lxsession/environment.c lines 678-679 No wonder it was not working properly. Time to file a bug report upstream then. Hope it gets fixed promptly.
In the interim you could just change the value to the one you need. I.e. grab lxsession from ABS, makepkg -o to get the sources, go in and change the hardcoded value to one that works for you, then makepkg -e. Then youd just need to pacman -U the built package. I do this to eliminate window hints from xfce4 terminal.
But yeah, that definitely shouldnt be hardcoded- should pull the value from /etc/environment at the very least.
Will do. First I need to learn what does involve doing everything in that process, but it should be interesting. And for my own good I should better learn how since it does seem that the fix will take a while to drop based on the amount of activity the bug tracker has.
Offline
hpstg wrote:ANXHaruhi wrote:This was a rabbit chase but I finally found it! After downloading the source code and doing some searches, LXDE has QT_PLATFORM_PLUGIN and QT_QPA_PLATFORMPLUGIN value hard coded in lxsession, so no matter if the variable is declared properly, when lxsession starts overwrites the value so it doesn't cascade properly. That leads to the aforementioned behavior where apparently it does not initialize. For those interested is in the lxsession package ~/lxsession/environment.c lines 678-679 No wonder it was not working properly. Time to file a bug report upstream then. Hope it gets fixed promptly.
Do you believe that something similar might be happening with Gnome? Unfortunately I don't have the expertise to look into the code, I wouldn't even know where to begin.
It may be. At the end of the day I don't know that much (in fact I am using linux seriusly for less than 2 months and the purpose of Arch was learn by doing), I just started pulling from the string "What happens if..." from the login screen until it appears on my screen."What happen if..." "... I use another DE?" It gets exported correctly and works. Let's see how exactly boots LXDE when I press the login button. "... I export the variables just before it starts executing the session?" The variables work, look further down the line. Time to look at the log for LXSession, "... I search for environment, QT and similar keywords, or files loaded through it?" No references, so the answer does have to lie inside LXSession, repeat again, download the sources and do a quick search inside the files with your tool of choice, and the answer appears.
The process should be something similar for GNOME. I don't know how GNOME works, but the logic steps for diagnose should apply pretty much here as well. Start by exporting it properly in your ~/.profile and ~/.pam_environment only, relog and check the output of "printenv | grep QT" in console as normal user. If it shows properly in console but it doesn't open correctly the app, or it doesn't open the app, something is overriding at login your config. Most certainly GNOME or unlikely some other program. To be sure, install something like Openbox, XFCE4 or MATE and boot into it, open a console and check the environment variables again. If it exports them properly it means that it is something specific that loads from GNOME, so you will have to find the login entry point and start cutting the login process in big logic segments. In each segment you will have to either use some relevant log that the desktop makes available or use a script to export the variables before or after the execution of a specific segment of the process until you get the chunk that doesn't load that variable. There will lie the root of the problem.
GSF1200S wrote:ANXHaruhi wrote:This was a rabbit chase but I finally found it! After downloading the source code and doing some searches, LXDE has QT_PLATFORM_PLUGIN and QT_QPA_PLATFORMPLUGIN value hard coded in lxsession, so no matter if the variable is declared properly, when lxsession starts overwrites the value so it doesn't cascade properly. That leads to the aforementioned behavior where apparently it does not initialize. For those interested is in the lxsession package ~/lxsession/environment.c lines 678-679 No wonder it was not working properly. Time to file a bug report upstream then. Hope it gets fixed promptly.
In the interim you could just change the value to the one you need. I.e. grab lxsession from ABS, makepkg -o to get the sources, go in and change the hardcoded value to one that works for you, then makepkg -e. Then youd just need to pacman -U the built package. I do this to eliminate window hints from xfce4 terminal.
But yeah, that definitely shouldnt be hardcoded- should pull the value from /etc/environment at the very least.
Will do. First I need to learn what does involve doing everything in that process, but it should be interesting. And for my own good I should better learn how since it does seem that the fix will take a while to drop based on the amount of activity the bug tracker has.
Its real easy- ive pretty much already explained it First make sure ABS is installed (run as root or with sudo)[installs abs with pacman]:
pacman -S abs
Make sure ABS is updated (run as root or with sudo)[abs updates using rsync]:
abs
Then, use a file manager or cp to copy over the directory at /var/abs/community/lxsession (not as root)[cp -r recursively copies directories/files from the first path to the second path]:
cp -r /var/abs/community/lxsession ~/lxsession
Then open a terminal and change to that directory [changing directory to the ~/lxsession directory]:
cd ~/lxsession
Get the sources [download sources but do not build or do anything else with them]:
makepkg -o
Open up a file manager and navigate to the directory (its the directory 'lxsession' in your /home/user directory). Then navigate to the source directory in that directory, and navigate to the file you traced down to have the errant QT variable listed above. Open with a text editor, make your changes, save the file, and exit. Then go back to your terminal and build the package [build using existing sources]:
makepkg -e
Once the resulting lxsession tar.xz is built, install it with pacman:
pacman -U lxsession-whatever-version-is-made-here.tar.xz
Done.
Offline
Is anyone else finding 2 little bugs in smplayer with this qt5ct method?:
-the error dialog window's background is pure white regardless of color settings
-the fullscreen controls' background are also pure white, despite the non-fullscreen controls' background obeying color settings
I'm using Arc-Dark if that makes it easier to test.
Offline