[Development] High-dpi Qt best practices

Samuel Rødal samuel.rodal at digia.com
Thu Oct 11 09:36:40 CEST 2012


On 10/11/2012 08:23 AM, Ziller Eike wrote:
>
> On 10.10.2012, at 16:56, Olivier Goffart wrote:
>
> If you'd now be able to change the unit in Qt to "pixel metrics" for
> certain widgets (and optionally sub widgets) where you really want to
> take advantage of each and every pixel in e.g. painting code, then every
> case would be covered. (And you could decide to do what you suggest.)

Agreed, it definitely needs to be possible to turn off the 2x2 scaling 
for widgets that _do_ care about individual device pixels.

>> The only thing is about QPen. should we draw lines twice as large?
>>  that is
>> bascically what QPen::isCosmetic is for

Tricky question. As Shawn said, a 0-width pen might mean people want the 
thinnest pen possible, which would mean not scaling those by 2x2.

However, it is also the default pen, and might be used in styles and 
other code in combinations with rectangles etc to create insets / outset 
shading effects for buttons. In those cases scaling is probably the 
right choice.

So I'd say the safest choice would be to scale cosmetic pens by 2x2 as 
well in the HiDpi mode.

--
Samuel





More information about the Development mailing list