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

william.crocker at analog.com william.crocker at analog.com
Mon Mar 18 19:47:02 CET 2019


>
> 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);
>

Please keep going...

How do you use m_image_scale ?

Bill



More information about the Interest mailing list