Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-97412

Draw one QPicture to QImag but the pos not right

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.15.6, 6.2.0
    • GUI: Painting
    • 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? 

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            vgt Eirik Aavitsland
            jixianglong Xianglong Ji
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes