[Qt-qml] QML vs Photoshop point unit

michael.brasser at nokia.com michael.brasser at nokia.com
Mon Jul 19 08:04:38 CEST 2010


Hi,

On 19/07/2010, at 3:14 PM, ext Gregory Schlomoff wrote:
> I just noticed that there is a difference between point sizes in
> Photoshop and QML by a factor of 1.32.
> For example, if I set a text to a pointSize of 50 in QML, I must set
> the text to 50 * 1.32 = 66 points in Photoshop to get the same size.
> 
> While there is nothing wrong with that, I was wondering if there was
> some explanation for this difference, as points theoretically are a
> standardized unit (1pt = 1/72 of an inch)

1.32 sounds very close to 96/72 -- one possibility is that your screen has a dpi of 96, while the photoshop document is 72 dpi.

pointSize can be a big "gotcha" when developing on the desktop and then deploying to a device with much higher dpi. e.g. if you've designed something like this:

//Button.qml
Rectangle {
    height: 50
    Text { font.pointSize: 24; anchors.centerIn: parent }
}

The Text height relative to the Rectangle height will differ greatly between the two platforms, since the Rectangle has a fixed pixel height, while the Text pixel height depends on the DPI. (in which case you can either use pixelSize instead of pointSize, or make the Rectangle height depend on the Text height)

Regards,
Michael



More information about the Qt-qml mailing list