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

QPainter drawLines incorrect splitting

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • None
    • 5.12.1, 5.12.2
    • GUI: Painting
    • None
    • Arch Linux 5.0.7 Qt 5.12.2 (gcc 8.2.1 and clang 8.0.0)
      Windows 10 Pro 1809 (17763.437) Qt 5.12.2 and 5.12.1 (MinGW 64bit and MSVC2017 64bit) (VMware VM)
      macOS Mojave 10.14.4 Qt 5.12.2 (clang 10.0.1) (VMware VM)
    • Linux/Wayland, macOS, Windows

    Description

      Lines drawn with drawLines and functions that call drawLines like drawPolygon have uneven/incorrect splits. Using the following code produces the result shown in lines.jpg attachment. It also draws one pixel at 0,0 coordinates.

      Test code:

      void mQWidget::paintEvent(QPaintEvent *event)
      {
          QPainter painter;
          painter.begin(this);
          painter.fillRect(this->rect(), QBrush(Qt::black, Qt::SolidPattern));
      
          QPen pen(Qt::white);
          pen.setStyle(Qt::SolidLine);
          painter.setPen(pen);
      
          QVector<QLineF> lines(10);
          lines.append(QLineF(QPointF(10, 10), QPointF(10, 100)));
          lines.append(QLineF(QPointF(20, 10), QPointF(21, 100)));
          lines.append(QLineF(QPointF(30, 10), QPointF(32, 100)));
          lines.append(QLineF(QPointF(40, 10), QPointF(43, 100)));
          lines.append(QLineF(QPointF(50, 10), QPointF(54, 100)));
      
          lines.append(QLineF(QPointF(70, 10), QPointF(70, 100)));
          lines.append(QLineF(QPointF(80, 10), QPointF(79, 100)));
          lines.append(QLineF(QPointF(90, 10), QPointF(88, 100)));
          lines.append(QLineF(QPointF(100, 10), QPointF(97, 100)));
          lines.append(QLineF(QPointF(110, 10), QPointF(106, 100)));
      
          painter.drawLines(lines);
          painter.end();
      }
      

      Attachments

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

        Activity

          People

            vgt Eirik Aavitsland
            lemon_ John Doe
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes