Recent

Author Topic: QT5 not following dark theme  (Read 6398 times)

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
QT5 not following dark theme
« on: July 13, 2021, 01:59:09 am »
QT5 apps running on newer Linux installs are not picking up the desktop colours.

For example, if I run a test app on Ubuntu20.04 set to Dark, the app displays in the Dark colours. Take the same binary to a U21.04 box, also set to Dark and it runs in light mode.

Debian Bullseye, U21.04 and Fedora 33 all seem to show this problem, older versions of the same distros are OK.  Its not a desktop thing, I can demonstrate this issue in Gnome, Mate and XFCe. Its not a core Lazarus thing because the same binary is fine in an older distro.

I am assuming there is some QT5 library/plugin/something being left out of the packaging, anyone know any details ?

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

zeljko

  • Hero Member
  • *****
  • Posts: 1594
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: QT5 not following dark theme
« Reply #1 on: July 13, 2021, 08:54:29 am »
It is up to Qt5 theme, we can do exactly nothing about it.

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: QT5 not following dark theme
« Reply #2 on: July 13, 2021, 09:25:54 am »
Thanks zeljko, but I don't understand.

Are you suggesting that the themes we are seeing now lack support for QT5 ?  In a lot of cases, these themes have changed very little between the Linux versions where QT5 apps display the right colours and now, when they don't.  Is that because distro providers have removed something from the themes that QT5 apps need ?

If so, we can make a fuss about that !

I understood that when someone designs a theme, they don't design separate (eg) GTK2, GTK3 and QT5 widgets, they combine colours, bitmaps and perhaps some rules that they expect the Desktop will pass on to the application no matter which widget set its using.  Or so thinks I ?

Davo

Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

zeljko

  • Hero Member
  • *****
  • Posts: 1594
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: QT5 not following dark theme
« Reply #3 on: July 15, 2021, 07:12:43 pm »
Qt5 LCL application should look exactly same as any KDE or Qt5 application. If it doesn't then please write what distro, window manager and qt5 version you use.

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: QT5 not following dark theme
« Reply #4 on: July 16, 2021, 06:09:55 am »
Thanks zeljko, I have done a quick survery of the VMs I use for testing, with the exception of the U2004 Mate one (my actual work box) they are all pretty much as intended by the distro managers.

In broad summary -

Ones with this problem -
Debian Bullseye in Mate and Gnome
Ubuntu Gnome 18.04, 20.04 and 21.04
Ubuntu XFCe 21.04

Ones that don't have the problem -
Fedora 34 Gnome
Mint 21 Cinnonem
MX 19.3 KDE
SUSE Leap 15.3
Ubuntu 20.04 Mate

All are using their default Window Manager, I tried changing my U2004Mate from Marco to Comwiz and it did not change anything. I changed Bullseye Mate  from Marco Adaptive to Marco and again, it did not change.

I believe all the Gnome boxes are using Wayland, I tried changing U2104Gnome to X and it did not change the problem.

I am pretty sure Mate or XFCe boxes are NOT using Wayland. The one KDE on MX is an older release.

So, in summary, it does not seem to relate to either Desktop, Window Manager or Display Manager. Does seem to relate somewhat to the Debian/Ubuntu world.  Honestly, I don't think its an issue in the Lazarus Code, otherwise I would log it in Mantis.  I think it relates to something missing in the standard install of Qt in some distros. If we can workout what, it can be added as a dependency ! Too easy !

Images below indicate distro, version and desktop in file name. In every case they are running the same binary, compiled with FPC320 and Lazarus Trunk. The test VM set to Adwainta Dark or similar. I have some 11 images but allowed (sensibly) only four, sure you understand I have images to support the lists above. Hmm, wonder if I can identify whats missing with strace ?

Davo
« Last Edit: July 16, 2021, 06:11:43 am by dbannon »
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

zeljko

  • Hero Member
  • *****
  • Posts: 1594
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: QT5 not following dark theme
« Reply #5 on: July 16, 2021, 09:38:51 am »
It's just lack of support for Qt5 theme, nothing we can do about it.

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: QT5 not following dark theme
« Reply #6 on: July 16, 2021, 10:37:17 am »
Hmm, firstly, I was wrong about SUSE using wayland, it does not. But Fedora definitely does use wayland and it does not exhibit this problem.

I have been using strace to compare the things loaded on U21.04 and Fedora 34, both gnome. Fedora is OK but Ubuntu is not. There are a few things loaded in Fedora that are not available (from the Ubuntu repo) in Ubuntu, maybe thats a QT version issue ?  Anyway, if its one of those, won't help us in anyway.

It is possible, of course, to solve the problem by installing qt5ct and configuring it to a dark theme. And then telling your app about it.   Strace then shows us it reading the file ~/.config/qt5ct/qt5ct.conf. That works fine but it does involve quite a lot of end user interaction to configure.  And end users don't like that.

 :(

I think I will document qt5ct on https://wiki.freepascal.org/Qt5_Interface - it needs a update anyway, Qt5 apps seem pretty good under wayland systems now !

Thanks zeliko

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

zeljko

  • Hero Member
  • *****
  • Posts: 1594
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: QT5 not following dark theme
« Reply #7 on: July 16, 2021, 12:16:47 pm »
I'm using qt5ct on linuxmint and there's no better solution. Usually ubuntu does not care too much about KDE and Qt, so that's why qt5ct exists.

 

TinyPortal © 2005-2018