[Development] High-dpi Qt best practices

Sorvig Morten Morten.Sorvig at digia.com
Tue Oct 9 21:53:06 CEST 2012


Thiago:
>On terça-feira, 9 de outubro de 2012 09.46.37, Sorvig Morten wrote:
>> I'm re-defining it to be the size in points. I think this intuitive, you are
>> asking QIcon::pixmap() for pixmap suitable for covering this many units on
>> screen - not for a pixmap of a specific size.
>
> When you write the documentation, please be clear that this is an "Apple's
> dea of point", not what everyone else currently uses (1/72 of an inch).

Isn't it the same? My code is 

painter->drawPixmap(QRect(0,0,72,72), QIcon::pixmap(72,72));

I run the code on normal-dpi screen and measure the drawn pixmap with a ruler. It's one inch across. Then I run the same code on a high-dpi screen and measure again. It's still one inch across, but filled with more pixels.

(assuming that the screens have exactly 72 and 144 pixels per inch, respectively)

Conclusion: the name is inaccurate. High-ppi (as in pixel) would be better, since point geometry does not change.

Morten


More information about the Development mailing list