Get not scaled paint device on QWidget::paintEvent (ignoring devicePixelRatio)
-
Environment: OS Windows 10, 4K display, Scale and layout set to 200% (important)
In qt5 on QWidget::paintEvent I have a paint device with full resolution of my screen and devicePixelRatio set to 1.0, logicalDpiX returns 192, I do my own drawing there with my required zoom and I use some aligning to physical resolution so my drawing is not blurry.
In qt6 on QWidget::paintEvent I have a paint device with twice reduced resolution of my screen and devicePixelRatio is 2.0,, logicalDpiX returns 96, so I cannot draw hi-res image because of poor resolution.
The question is, how to make Qt6 behave like it was before (full resolution and logicalDpiX equal to 192, independent from scale)?
I just want full resolution device for drawing, so I can port my current solution and utilize all the pixels of display.
-
Hi and welcome to devnet,
Did you already went through the Hi DPI chapter and the linked part about drawing images at high resolution ?
It looks like the effect you describe.
-
@SGaist
Thank you for the warm welcome)))Yes, I’ve read that part, unfortunately it doesn’t change anything for me.
In qt6 resolution and logical dpi twice less then it is in real world, and it makes me some problems.
The size of drawing area is smaller, so I cannot just set transformation, as the size of device remains the same.
I need somehow forbid dpi scaling.I just need to forbid any scaling or transformation for device made by new Qt behavior, as it was in Qt5.
Another workaround is drawing to pixmap separately, but is it possible to set dpi to paint device? My code rely on it, and I haven’t found any function for setting dpi manually.
-
Did you already saw the Scalability part ?
QPainter uses the devicePixelRatio of the target.