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

Jason H jhihn at gmx.com
Tue Sep 26 15:40:12 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.

My crazy thought of the day:
The HTML 5 Canvas blits text 0.5 pixels offset. How would that change the top 150% render?



More information about the Development mailing list