Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.15.6, 6.2.0
-
None
Description
I used QPicture to save the drawing command, and then I drew it to QImage, but this resulted in incorrect coordinate mapping on some images.
there is one demo to show this bug (use mouse to draw on imag),'desert.png' and 'lake.jpg' pos mapping is right,but the 'car.jpg' is wrong.
i found that 'car.jpg' dpi is 72, 'desert.png' and 'lake.jpg' are 96.Then i track the source code of QPicture ,i found the QPicture::exec() function do one scale cause this:
QTransform worldMatrix = painter->transform(); worldMatrix.scale(qreal(painter->device()->logicalDpiX()) / qreal(qt_defaultDpiX()), qreal(painter->device()->logicalDpiY()) / qreal(qt_defaultDpiY())); painter->setTransform(worldMatrix);
but why?
in addition, i change image dpi to my screen dpi(96) by QImage::setDotsPerMeterX and QImage::setDotsPerMeterY.
is that a right solution?