[Development] Retina display support

Ziller Eike Eike.Ziller at digia.com
Fri Sep 21 15:47:06 CEST 2012


On 21 Sep 2012, at 15:30, P Bai <apbai at yahoo.com>
 wrote:

> Thank you, Eike. From what I read in the codereview, a function to get the scale factor qt_mac_get_scalefactor() is available as a patch, but QPixmap/QImage HiDPI support is still a WIP. Does that mean even if I were able to detect HiDPI mode, I still can't do anything until QPixmap/QImage support becomes available. Is that right?

That's how I read it, yes. Note though that qt_mac_get_scalefactor() is a private method in a private header.

Br Eike

> Thank you again!
> P
> 
> 
> ----- Original Message -----
> From: Ziller Eike <Eike.Ziller at digia.com>
> To: Kai-Uwe Behrmann <ku.b at gmx.de>
> Cc: P Bai <apbai at yahoo.com>; "development at qt-project.org" <development at qt-project.org>
> Sent: Friday, September 21, 2012 4:37 AM
> Subject: Re: [Development] Retina display support
> 
> 
> On 21 Sep 2012, at 07:12, Kai-Uwe Behrmann <ku.b at gmx.de> wrote:
> 
>> Am 20.09.12, 19:09 -0700 schrieb P Bai:
>>> I have a few questions about how to add retina display support to my application. I understand by reading an earlier discuss that you can add a few lines in the info.plist to enable HiDPI render. That would only work for text and standard widgets, right?
> 
> Right.
> 
>>> How about icons and pixmaps? How do I detect if the application is running in HiDPI mode?
> 
> At the moment only through platform API, e.g. UIScreen scale
> 
>>> For example if I write an image viewer program, how do I know when to draw a high resolution image? I guess I can just always force draw the high-res image to the rect of a regular sized image,
> 
> I don't think that would work atm. Afaik Qt doesn't draw at "sub-point" coordinates as is and would downscale your high-res image to the point size of the rectangle. (See below for an explanation what I mean with that.)
> 
> Morten Sørvig is working on a solution for the HiDPI issue, a (probably outdated) experiment is on https://codereview.qt-project.org/33266
> 
>>> but that would be a huge waste of system resource and performance drag when running on non-retina system. Are there any better solutions?
>> 
>> Aren't you seeing the window size in pixels as usual? With that available, you would have a generic answere for your kind of question.
> 
> Well, no. "Pixel" in the Qt world atm means something different than "pixel" in the physical world (when talking about Cocoa / Mac).
> The integer coordinates in Qt actually are mapped to what Cocoa calls "points" which is referring to "logical" coordinate space, not "device" coordinate space.
> A HiDPI screen has the same number of "points" as a corresponding non-HiDPI screen, but it has a "scale" (of 2). Applications see the same number of points when they run on a HiDPI screen as they would on a non-HiDPI screen (--> everything has exactly the same physical dimensions when running on different screens).
> That means that Qt also reports the same dimensions. Rastering for pixmaps is also done based on "points".
> 
> -- 
> Eike Ziller
> Senior Software Engineer
> 
> Digia Germany GmbH
> Rudower Chausse 13, 12489 D-Berlin
> Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B,  
> Geschäftsführer: Mika Pälsi, Juha Varelius, Anja Wasenius
> Email: eike.ziller at digia.com
> Tel: +49 30 63 92 32 55
> 
> Digia Germany is a group company of Digia Plc,
> Valimotie 21, FI-00380 Helsinki Finland
> Visit us at: www.digia.com
> ------------------------------------------------------------------
> PRIVACY AND CONFIDENTIALITY NOTICE
> This message and any attachments are intended only for use by the named addressee and may contain privileged and/or confidential information. If you are not the named addressee you should not disseminate, copy or take any action in reliance on it. If you have received this message in error, please contact the sender immediately and delete the message and any attachments accompanying it. Digia Germany GmbH and Digia Plc do not accept liability for any corruption, interception, amendment, tampering or viruses occurring to this message.

-- 
Eike Ziller
Senior Software Engineer
 
Digia Germany GmbH
Rudower Chaussee 13, 12489 D-Berlin
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B,  
Geschäftsführer: Mika Pälsi, Juha Varelius, Anja Wasenius
Tel: +49 30 63 92 32 55
 
Digia Germany is a group company of Digia Plc,
Valimotie 21, FI-00380 Helsinki Finland
Visit us at: www.digia.com
------------------------------------------------------------------
PRIVACY AND CONFIDENTIALITY NOTICE
This message and any attachments are intended only for use by the named addressee and may contain privileged and/or confidential information. If you are not the named addressee you should not disseminate, copy or take any action in reliance on it. If you have received this message in error, please contact the sender immediately and delete the message and any attachments accompanying it. Digia Germany GmbH and Digia Plc do not accept liability for any corruption, interception, amendment, tampering or viruses occurring to this message.




More information about the Development mailing list