[Development] High-dpi Qt best practices
Sorvig Morten
Morten.Sorvig at digia.com
Tue Oct 9 11:31:30 CEST 2012
On Oct 9, 2012, at 10:59 AM, Pritam <pritam_ghanghas at infosys.com>
wrote:
> Forgive my ignorance, but I didn't understand. AFAIK most of Qt API is
> in pixels. Do you mean after this patch, one should treat all API as points?
No problem, the concepts are new and I'm still figuring out how they apply to Qt and how to best present them.
If you don't care about supporting high-dpi you can continue as before, behaviour changes are opt-in. You can even get some support for free, for example text and mac style. If you work on Qt itself then I argue that you _should_ care about high-dpi.
If you do want to support high-dpi then you should aware of the points/pixels distinction. And again the main message here is that very little changes, you deal with widget and event geometry as before and can draw using QPainter using the widget coordinate system. Behind the scenes QPainter will fill in 4x as many pixels on high-dpi displays. Which means you should provide more pixels when using raster images and pixmaps.
So it's mostly a name change. On high-dpi displays the main coordinate system units are not pixels any more, but we can pretend they are and get away with it in most cases.
Morten
More information about the Development
mailing list