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

QQuickPaintedItem displays incorrectly on Hi-DPI when set transform

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • None
    • 6.5.0
    • None
    • win11
    • Windows

    Description

      Normally, if I set the default transform[(1,0,0),(0,1,0),(0,0,1)] for QPainter, the image should be drawn without any changes, and it should fill the entire control. However, I found that this is not the case on high-DPI.

      class QImageViewer : public QQuickPaintedItem
      {
      ...
      private:
          virtual void paint(QPainter* painter) override;
          QTransform param_matrixWorld;
      ...
      }
      
      void QImageViewer::paint(QPainter* painter)
      {
          painter->setWorldTransform(param_matrixWorld);
          qDebug()<<param_matrixWorld;
      
          if (image2Draw.width() > 0 && image2Draw.height() > 0)
          {
              painter->drawImage(QRect(0, 0, width(), height()), image2Draw, QRect(0, 0, image2Draw.width(), image2Draw.height()));
          }
      
          //Now disable matrixWorld for overlay display
          painter->setWorldMatrixEnabled(false);
      }
      

      Attachments

        1. example.jpg
          179 kB
          Peiqi Liu
        2. normal(Qt5.15.2).png
          226 kB
          Peiqi Liu
        3. QMLApplication.7z
          5 kB
          Peiqi Liu
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kagro Kaj Grönholm
            peiqi.liu Peiqi Liu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes