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

Incorrect filled path when using QPainterPath::cubicTo() and combined transformations

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.6.0
    • 4.4.0
    • GUI: Painting
    • None

    Description

      Incorrect filled path when using QPainterPath::cubicTo() and combined transformations

      Test case main.cpp to reproduce
      ==============================
      #include <QtGui>
      class MainWindow : public QWidget
      {
      Q_OBJECT
      public:
      MainWindow(QWidget *parent=0);
      void paintEvent(QPaintEvent*);
      };
      MainWindow::MainWindow(QWidget *parent)
      : QWidget(parent)
      {
      resize(400,400);
      }
      void MainWindow::paintEvent(QPaintEvent *)
      {
      QRect r = rect();
      qreal w = width();
      qreal h = height();
      QImage image(r.width(), r.height(),
      QImage::Format_ARGB32_Premultiplied);
      // create painter
      QPainter painter(&image);
      painter.setRenderHints(QPainter::Antialiasing);
      // blan image
      painter.fillRect(image.rect(), Qt::white);
      // setup transform
      painter.translate(w/2, h/2);
      qreal s = qMin(w,h)/250.0;
      painter.scale(s,s);
      QTransform t;
      t.rotate(45, Qt::XAxis);
      painter.setTransform(t, true);
      // setup path
      QPainterPath path;
      path.moveTo(QPointF(-100,-100) );
      path.cubicTo(-100,100,100,-100,100,100);
      path.closeSubpath();

      QBrush b(Qt::red);
      painter.fillPath(path, b);

      QPen p(Qt::blue, 5, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
      p.setMiterLimit(10);
      painter.setPen(p);
      painter.drawPath(path);

      QPainter painter1(this);
      painter1.drawImage(0,0,image);
      }
      int main(int argc, char **argv)
      {
      QApplication a(argc,argv);
      MainWindow m;
      m.show();
      a.exec();
      }
      #include "qttest.moc"

      Attachments

        Issue Links

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

          Activity

            People

              sletta Gunnar Sletta
              admin Administrator
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes