Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.2, 5.15.3, 6.1.0 Beta3
Description
Qt seems to use different roundings when calculating pixel values from device independent pixels, I have not checked the Qt source code, but I have done some testing.
My screen is set to 125% scaling so I have a device pixel ratio of 1.25 in Qt.
Calling the following method
QPixmap pixmap = icon.pixmap(QSize(26, 26));
Results in a pixmap that is 33x33 pixels
26 * 1.25 = 32.5 rounded up to 33
Then calling
painter.drawPixmap(QRect(0,0,26,26), pixmap);
This renders an image that is 32x32 pixels big.
26 * 1.25 = 32.5 rounded down to 32
This causes a bitmap scaling to occur from 33x33 -> 32x32 pixels, which results in a distorted image.