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

anti-aliasing+hi-dpi Scaling -> The drawing area and the refresh area do not match

    XMLWordPrintable

Details

    • All, Linux/X11

    Description

      As shown in the attachment, when setting anti-aliasing under zooming, the drawing area and refresh area are not synchronized.

       

      class TestWindow : public QWidget
      {
      public:
          explicit TestWindow(QWidget *parent = 0)
              : QWidget(parent)
          {
      
          }
      
          void mousePressEvent(QMouseEvent *e)
          {
              if (e->button() == Qt::LeftButton) {
                  press_pos = e->pos();
              }
          }
      
          void mouseReleaseEvent(QMouseEvent *e)
          {
      
          }
      
          void mouseMoveEvent(QMouseEvent *e)
          {
              update(rect);
      
              rect.setLeft(qMin(press_pos.x(), e->pos().x()));
              rect.setTop(qMin(press_pos.y(), e->pos().y()));
              rect.setRight(qMax(press_pos.x(), e->pos().x()));
              rect.setBottom(qMax(press_pos.y(), e->pos().y()));
      
              update(rect);
          }
      
          void paintEvent(QPaintEvent *e)
          {
              QPainter pa(this);
              pa.setRenderHints(QPainter::Antialiasing);
              //pa.setRenderHints(QPainter::Antialiasing, false);
              pa.fillRect(rect, color);
          }
      
          QPoint press_pos;
          QRect rect;
          QColor color;
      };
      

       

      Attachments

        1. QTBUG-85976.tar.gz
          1 kB
          Liang Qi
        2. QTBUG-85976.zip
          7 kB
          haixiang tang
        3. 截图录屏_选择区域_20200811161536.gif
          77 kB
          haixiang tang

        Activity

          People

            sorvig Morten Sørvig
            tanghaixiang haixiang tang
            Veli-Pekka Heinonen Veli-Pekka Heinonen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: