You can also check the device pixel ratio for image “@2” alike: qreal pixel_ratio = QGuiApplication::primaryScreen()->devicePixelRatio(); unsigned int image_scale_ratio = pixel_ratio / 1u; QString m_image_scale = image_scale_ratio <= 1u ? "" : QString("@%1x").arg(image_scale_ratio);
This is what I do. [36E56279] une compagnie [cid:image008.jpg@01D4DD95.0986ECD0] 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:image009.png@01D4DD95.0986ECD0]<https://www.facebook.com/LesSolutionsAmotus/> [cid:image010.png@01D4DD95.0986ECD0] <https://www.linkedin.com/company/amotus-solutions/> [cid:image011.png@01D4DD95.0986ECD0] <https://twitter.com/AmotusSolutions> [cid:image012.jpg@01D4DD95.0986ECD0] <https://www.youtube.com/channel/UCoYpQgsmj1iJZyDjTQ3x8Ig> From: Interest <interest-boun...@qt-project.org> On Behalf Of Jérôme Godbout Sent: March 18, 2019 2:13 PM To: Vadim Peretokin <vpereto...@gmail.com>; interestqt-project.org <interest@qt-project.org> Subject: Re: [Interest] How to detect a HiDPI display with Qt? 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:image014.jpg@01D4DD95.0986ECD0] 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:image015.png@01D4DD95.0986ECD0]<https://www.facebook.com/LesSolutionsAmotus/> [cid:image016.png@01D4DD95.0986ECD0] <https://www.linkedin.com/company/amotus-solutions/> [cid:image017.png@01D4DD95.0986ECD0] <https://twitter.com/AmotusSolutions> [cid:image018.jpg@01D4DD95.0986ECD0] <https://www.youtube.com/channel/UCoYpQgsmj1iJZyDjTQ3x8Ig> From: Interest <interest-boun...@qt-project.org<mailto:interest-boun...@qt-project.org>> On Behalf Of Vadim Peretokin Sent: March 18, 2019 1:00 PM To: interestqt-project.org <interest@qt-project.org<mailto:interest@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?
_______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest