[Interest] How to detect a HiDPI display with Qt?

Jérôme Godbout godboutj at amotus.ca
Mon Mar 18 19:12:46 CET 2019


You can check the dpi of the screen:
QGuiApplication::primaryScreen()->logicalDotsPerInch();

You can then check if the dpi is above certain threshold to do thing differently. Normal desktop full HD screen dpi is around 96.


[36E56279]
une compagnie  [cid:image002.jpg at 01D4DD94.AA6DD510]
RAPPROCHEZ LA DISTANCE

Jérôme Godbout
Développeur Logiciel Sénior /
Senior Software Developer

p: +1 (418) 800-1073 ext.:109

amotus.ca<http://www.amotus-solutions.com/>
statum-iot.com<http://statum-iot.com/>
[cid:image003.png at 01D4DD94.AA6DD510]<https://www.facebook.com/LesSolutionsAmotus/> [cid:image004.png at 01D4DD94.AA6DD510] <https://www.linkedin.com/company/amotus-solutions/>  [cid:image005.png at 01D4DD94.AA6DD510] <https://twitter.com/AmotusSolutions>  [cid:image006.jpg at 01D4DD94.AA6DD510] <https://www.youtube.com/channel/UCoYpQgsmj1iJZyDjTQ3x8Ig>





From: Interest <interest-bounces at qt-project.org> On Behalf Of Vadim Peretokin
Sent: March 18, 2019 1:00 PM
To: interestqt-project.org <interest at qt-project.org>
Subject: [Interest] How to detect a HiDPI display with Qt?

I'm not clear on how to detect if a display is HiDPI with Qt. I've tried QApplication.desktop()->screen()->devicePixelRatio() but even that returns 1 for a display that is 3840x2160.

Has anyone got hints on how to do this successfully?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190318/a36c0ce6/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 6751 bytes
Desc: image001.jpg
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190318/a36c0ce6/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 1016 bytes
Desc: image002.jpg
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190318/a36c0ce6/attachment-0001.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 483 bytes
Desc: image003.png
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190318/a36c0ce6/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.png
Type: image/png
Size: 506 bytes
Desc: image004.png
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190318/a36c0ce6/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image005.png
Type: image/png
Size: 500 bytes
Desc: image005.png
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190318/a36c0ce6/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image006.jpg
Type: image/jpeg
Size: 713 bytes
Desc: image006.jpg
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190318/a36c0ce6/attachment-0002.jpg>


More information about the Interest mailing list