[Interest] Handling various displays on mobile...

Alejandro Exojo suy at badopi.org
Tue Jan 27 17:40:04 CET 2015


El Tuesday 27 January 2015, Jason H escribió:
> I've spec'd the text my QML ui in points, and that works well. But the
> problem comes when i calculate padding and offsets in pixels. It looks
> great on my device (Note 2) but on newer devices with higher DPIs, the UI
> looks un-padded.  I need a way to get the DPI so I can properly calculate
> spacing.
> 
> How is that done in QML?

Try with the Screen QML type:

http://doc.qt.io/qt-5/qml-qtquick-window-screen.html#devicePixelRatio-attached-prop

Note that the property was added in Qt 5.4.

-- 
Alex (a.k.a. suy) | GPG ID 0x0B8B0BC2
http://barnacity.net/ | http://disperso.net



More information about the Interest mailing list