[Interest] How to handle Windows magnification tool changes on a Qt app?

Zielinski, Mariusz UTC CCS Mariusz.Zielinski at fs.utc.com
Thu Nov 2 05:45:32 CET 2017


Nuno,

I'm using widgets for most of my projects and I've never used QtQuick. To detect screen changes I use signal  QScreen::logicalDotsPerInchChanged(qreal dpi). (You need to do calculation to get scaling factor.)
For all changes with desktop geometry I use QDesktopWidget::resized(int screen) signal. Using them I get consistent good results even in situation when window is dragged between screens with different scaling factor.
On recent builds of Win10 things are good as well as on Linux/Xorg. There may be better method of detecting it because standard widgets are scale aware but I didn't look.

To properly scale widgets I design their sizes around scale of 1 and when I detect change I cascade signals to change sizes of all custom widgets (standard ones are doing it automatically (mostly)).
What I noticed not all the standard widgets follow scaling factor changes but last time I was troubleshooting it it was Qt5.8 so things may have changed since then. One can speculate that bugs may have crept in into QtQuick as well.

http://doc.qt.io/qt-5/qscreen.html 
http://doc.qt.io/qt-5/qdesktopwidget.html

-- 
Mariusz Zielinski 

-----Original Message-----
From: Nuno Santos [mailto:nunosantos at imaginando.pt] 
Sent: 30 pazdziernika 2017 17:13
To: Qt Project MailingList <interest at qt-project.org>
Subject: [Interest] How to handle Windows magnification tool changes on a Qt app?

Hi,

There is a setting on Windows to make things bigger. This options is located under display preferences (right click on desktop -> display preferences)

I have tried that setting with a Qt Quick app and the result was quite unexpected. At a 150% setting, the app seems to be 4x bigger!

How can we detect changes to this setting inside a Qt app and how should we correctly react to changes?

Thanks!

Regards,

Nuno






More information about the Interest mailing list