Recent

Author Topic: Scaling the QT 5 application  (Read 640 times)

7bit

  • New Member
  • *
  • Posts: 24
Scaling the QT 5 application
« on: September 17, 2025, 09:27:46 pm »
My application does not scale when I change the scale of the desktop environment. When I launch my application, the interface does not scale. Although Lazarus IDE with QT5 scales. Everything is working fine in Windows. Maybe something needs to be turned on?

zeljko

  • Hero Member
  • *****
  • Posts: 1792
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Scaling the QT 5 application
« Reply #1 on: September 17, 2025, 09:47:38 pm »
Have you turned on scaling in your project options (in that case you'll have Application.Scaled := True in your .lpr file), or just add manually APplication.Scaled := True in your .lpr, before Application.initialize.

7bit

  • New Member
  • *
  • Posts: 24
Re: Scaling the QT 5 application
« Reply #2 on: September 18, 2025, 06:06:07 am »
Yes. I'm creating a simple QT5 application and it also doesn't scale. I was wrong about Lazarus. It doesn't scale either. This GTK2 build scales, but QT5 does not.

My IDE: Lazarus 4.3 (rev lazarus_4_2-26-g44b59001af) FPC 3.2.3 x86_64-linux-qt5
OS: Alt Workstation 10.4 (Mate Desktop)

zeljko

  • Hero Member
  • *****
  • Posts: 1792
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Scaling the QT 5 application
« Reply #3 on: September 18, 2025, 08:06:14 am »
Qt5 > 5.14 and Qt 6 changed how they use scaling. DPI is not relevant anymore but only scale eg 1.5, 2.0 etc. So to test if it'll work for you try this from terminal: export QT_FONT_DPI=96 export QT_SCALE_FACTOR=1.5 ./yourqt5application .

7bit

  • New Member
  • *
  • Posts: 24
Re: Scaling the QT 5 application
« Reply #4 on: September 18, 2025, 01:18:32 pm »
Thanks! It works. It's just not very nice; the app just scales down the low-resolution icons. When I set QT_FONT_DPI=144 and removed QT_SCALE_FACTOR, the app started using higher-resolution icons. I liked the result.

zeljko

  • Hero Member
  • *****
  • Posts: 1792
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Scaling the QT 5 application
« Reply #5 on: September 18, 2025, 03:34:51 pm »
It is pretty messy with scaling qt5 and qt6 nowadays (in LCL perspective). Note that under KDE Plasma 5 I don't have to export anything for qt5 widgetset, but must for qt6. On KDE Plasma 6 is viceversa :)

 

TinyPortal © 2005-2018