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

QPainterPath::intersected returns empty result

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.14.1
    • GUI: Painting
    • None
    • Opensuse 15.1, Intel cpu.

    Description

      The following code results in an empty QPainterPath for the first intersection:

       

      #include <QCoreApplication>
      #include <QDebug>
      #include <QPainterPath>
      
      int main(int argc, char *argv[])
      {
          QCoreApplication a(argc, argv);
      
          QPainterPath o;
          o.moveTo(68.00646200000001, 306.791802);
          o.lineTo(364.880318, 286.0312259999999);
          o.lineTo(349.309886, 63.37583399999997);
          o.lineTo(52.43603000000001, 84.13640999999998);
          o.lineTo(68.00646200000001, 306.791802);
          o.closeSubpath();
      
          QPainterPath p;
          p.moveTo(52.43603, 84.13640999999996);
          p.lineTo(349.34779328, 63.37318311999995);
          p.lineTo(364.92017856, 286.0565067999999);
          p.lineTo(68.00841528000001, 306.8197336799999);
          p.lineTo(52.43603, 84.13640999999996);
          p.closeSubpath();
      
      	QPainterPath i = o.intersected(p);
      	qDebug() << "o.intersected(p):" << i;
      	i = p.intersected(o);
      	qDebug() << "p.intersected(o):" << i;
          return 0;
      }
      

      The result is:
      o.intersected(p): QPainterPath: Element count=0

      p.intersected(o): QPainterPath: Element count=5
      -> MoveTo(x=68.0065, y=306.792)
      -> LineTo(x=52.436, y=84.1364)
      -> LineTo(x=349.31, y=63.3758)
      -> LineTo(x=364.88, y=286.031)
      -> LineTo(x=68.0065, y=306.792)

       

      It is expected to have rectangles of the same shape as a result in both cases. 

      Attachments

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

        Activity

          People

            vgt Eirik Aavitsland
            pontobart Christoph Bartoschek
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes