[Development] New approach to hi-dpi and coordinate system for layouts in Qt 6

Stephen Kelly stkelly at microsoft.com
Mon Sep 25 12:58:02 CEST 2017


> The approaches available currently either
> 
> 1) scale everything after rendering (eg with SetProcessDPIAware())
> 2) scale coordinates to screen metrics before rendering (QApplication::setAttribute(Qt::AA_EnableHighDpiScaling))
> 
> The first approach gives a blurry result because of up/down scaling and is not satisfying.
> 
> The second approach scales all coordinates, making it impossible to specify 'a one/two pixel border' without 
> that getting scaled too. Additionally, the AA_EnableHighDpiScaling will only apply integer scaling, so on a 
> screen with 150% scaling, the widget is scaled to 200%.  

I had a request to explain the problem with screenshots, so I created 

 https://bugreports.qt.io/browse/QTBUG-63402

with screenshots showing the previously posted code with the available approaches and APIs to solving
the problem, along with a screenshot showing the result of this proposal.

Thanks,

Stephen.



More information about the Development mailing list