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

QPolygonF::subtract returns wrong polygon

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.6.0, 5.9.0 Beta 1
    • GUI: Painting
    • None

    Description

      In the following example, QPolygonF::subtract returns a completely wrong polygon. It is not a simple matter of points order.

      #include <QPolygonF>
      #include <QRectF>
      #include <QDebug>
      
      int main()
      {
          QPolygonF   poly1(QRectF(0, 2, 1, 2));
          QPolygonF   poly2(QRectF(0, 0, 1, 4));
      
          qDebug() << "poly1 = " << poly1;
          qDebug() << "poly2 = " << poly2;
          qDebug() << "poly2.subtracted(poly1) = " << poly2.subtracted(poly1);
      
          // Reported result should be:
          // QPolygonF(QPointF(0,0), QPointF(1,0), QPointF(1,2), QPointF(0,2), QPointF(0,0));
         // but is
         // QPolygonF(QPointF(0,2)QPointF(1,2)QPointF(1,4)QPointF(0,4)QPointF(0,2)QPointF(0,0)QPointF(1,0)QPointF(1,4)QPointF(0,4)QPointF(0,0)QPointF(0,2))
      }
      

      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
              hyahiaoui Houssame Yahiaoui
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes