Device-independent-pixel sizing in Qt 5.6
-
tl;dr: Does Qt 5.6 ensure that QML element sizes are interpreted in device-independent pixel units when
Qt::AA_EnableHighDpiScaling
is set?
I'm trying to wrap my head around the high-DPI support in Qt. There are numerous posts/articles on the topic, including periodic forum questions here.
http://blog.qt.io/blog/2016/01/26/high-dpi-support-in-qt-5-6/
http://blog.qt.io/blog/2013/04/25/retina-display-support-for-mac-os-ios-and-x11/
http://doc.qt.io/qt-5/highdpi.htmlHowever, I still haven't found a practical usage example of how to avail of it. In Android, you use Device Independent Pixels (dp) to specify dimensions of layout elements, and can thereafter forget about screen dpi. How do you do this in Qt? There seems to be a passing reference to the fact that coordinates are in device-indep pixels in QML here:
http://blog.qt.io/blog/2013/04/25/retina-display-support-for-mac-os-ios-and-x11/"for app developers this doesn’t matter, you can do most of your work in the comfort of the device-independent pixel space while Qt and/or the OS does the heavy lifting"
However this video:
https://youtu.be/nNyhsdX6BsI?t=6m31s
suggests computing scale factors on your own and seems to specify number of actual screen pixels as element width/height values.So which is correct? When you specify for example:
Rectangle { width: 200 height: 100 . . . }
Are the numeric values automatically device-independent in Qt 5.6? Or do they become dev-independent only when Qt::AA_EnableHighDpiScaling is set (and are actual display pixels otherwise)? Or is neither of these true?