[Development] High-dpi Qt best practices
Thiago Macieira
thiago.macieira at intel.com
Tue Oct 9 22:42:56 CEST 2012
On terça-feira, 9 de outubro de 2012 19.53.06, Sorvig Morten wrote:
> 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));
1 pixel = 1 point if and only if the resolution is 72 dpi. I vaguely recall
something about the Mac having a hardcoded DPI setting of 72, which is why the
name "point" works.
Regular Windows setting is 96 dpi, meaning you need 96 pixels to make an inch,
or 4 pixels = 3 points.
> 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.
Android calls them "device-dependent pixels" (ddp).
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20121009/fcf18d0a/attachment.sig>
More information about the Development
mailing list