[Interest] High-dpi fixing for Qt 5.5

Till Oliver Knoll till.oliver.knoll at gmail.com
Tue Mar 24 14:26:09 CET 2015


> Am 19.03.2015 um 14:17 schrieb Sorvig Morten <Morten.Sorvig at theqtcompany.com>:
> 
> Hi,
> 
> ...
> 
> In case there issues that I’ve missed I would be interested in hearing about it. I can’t promise that everything will be fixed, but it will be at least put on the radar.

Hi Morten,

Not a bug by itself and hence a bit off-topic, but is there a way to detect "screen resolution changes" in some way? The use case is of course when an application window is moved from a Retina (HiDPI) screen to a non-Retina screen (or vice versa) (in a multi-monitor setup).

My knowledge of available "HiDPI" APIs is currently based on your (excellent) blog post, which does not seem to mention that use case:

 http://blog.qt.io/blog/2013/04/25/retina-display-support-for-mac-os-ios-and-x11/

I could imagine that getting informed e.g. by the QDesktopWidget (or some other related "screen/resolution" class) whenever the application is "switched" (dragged) to another screen, and then querying the resolution of the new screen, could be a solution. However I currently do not see any corresponding signal in QDesktopWidget's API, nor anywhere else...

In the end I am not even sure whether I need to get informed about this event, since most drawing - and also the switch between Retina/non-Retina worlds - is handled for me already by Qt/underlying Core Graphics APIs. Even the Apple Developer docs mention that "Listening for NSWindowDidChangeBackingPropertiesNotification is something only a few apps [...] will need to do."

However my app probably /is/ one of those that "specialize in video or graphics work". I draw on a QGraphicsView(-scene) and have QGraphicsPixmapItems with a QPixmap behind them. I imagine that I have to be able to dynamically switch between the normal and the "@2x" version of those pixmaps, and have the QGraphicsView paint itself whenever such a "resolution change" is detected. Or so I imagine...

So I am basically looking for a "cross-platform" way to get notified in analogy to the Cocoa notification

 NSWindowDidChangeBackingPropertiesNotification

See chapter "Handle Dynamic Changes in Window Resolution Only When You Must"

https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/CapturingScreenContents/CapturingScreenContents.html#//apple_ref/doc/uid/TP40012302-CH10-SW1


Or would I have access to this event (+ platform-specific code) in e.g. QWidget::nativeEvent (in the top-level QMainWindow)? The Apple docs talk about a "window delegate" (Cocoa code), to which I probably don't have (easy) access, at least not without modifying Qt's code itself - right? (I am not a Cocoa expert).


Is something like "detecting resolution changes" (otherwise) already possible, or is this on the "HiDPI Roadmap"?

Thanks, Oliver

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150324/89f88982/attachment.html>


More information about the Interest mailing list