[Interest] iPad mini Retina 2048 x 1536 display resolution issue with QtQuick apps

Till Oliver Knoll till.oliver.knoll at gmail.com
Wed Feb 12 09:56:39 CET 2014


Am 11.02.2014 um 22:43 schrieb VStevenP <vstevenpavao at yahoo.com>:

> Or perhaps the behavior I mentioned below is a feature? 

Yes, it's a feature ;)

You want to get familiar with the concept of "points" vs "pixels" (-> check the Apple developer docs, search for "retina" and the like) and how Qt implements that.

This is probably a good starting pixe^w point:

  https://blog.qt.digia.com/blog/2013/04/25/retina-display-support-for-mac-os-ios-and-x11/

Basically: when you want to draw a rectangle of a given width and height, don't think in pixels! Think in (device-independent) points instead.

Qt (and in the end Cocoa) will make sure that it has the same physical dimension on a HiDPI (aka "Retina") and a "normal DPI" screen (which have the same physical dimension) by fiddling around with the proper "scale" factors (in the Cocoa/Apple world that scale factor is always exactly 2.0 for Retina displays).

If it comes to images you usually need to provide two versions of your assets: a "normal resolution" and a "@2x" resolution.

E.g. a QIcon then properly chooses the right version for you.

When it comes to QPixmaps then you want to read about QPixmap::setDevicePixelRatio.

When it comes to drawing lines, rectangles and text with QPainter (and QtQuick 2 I assume) then you don't need to bother - Qt/Cocoa does it all for you (as long as you think in "points", that is).

Sorry, don't know much about QtQuick, but I assume it's all "pretty much the same logic" there ;)


Cheers,
  Oliver
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140212/15555a17/attachment.html>


More information about the Interest mailing list