Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-891

Cannot implement QPaintEngine.drawPolygon drawLines, drawPoints or drawRects in Python

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P3: Somewhat important
    • None
    • 5.11.2
    • PySide
    • None
    • n/a
    • All

    Description

      When implementing a new drawing back-ends for QPainter in Python custom implementations of QPaintEngine and QPaintDevice must be created within Python. These derived classes are required to implement certain virtual methods to implement the appropriate drawing behavior.

      The following methods of QPaintEngine are passed several values via pointer and count arguments:

      • QPaintEngine.drawPolygon(points, pointCount, mode)
      • QPaintEngine.drawLines(lines, lineCount)
      • QPaintEngine.drawPoints(points, pointCount)
      • QPaintEngine.drawRects(rects, rectCount)

      Since Python implementations of these functions will just be passed a wrapped version of the first value, it is not possible (as best I understand) to access subsequent values.

      The example program (attached) shows 'drawPolygon' being called in response to a QPainter.drawLine call and receiving only the coordinate of the start of the line:

       

      $ python example.py
      drawPolygon called with PySide2.QtCore.QPointF(1.000000, 2.000000), 2, PySide2.QtGui.QPaintEngine.PolygonDrawMode.PolylineMode
      

      Ideally these functions (in Python) should be called with a list (or similar) or some well documented mechanism for iterating over elements be provided.

       

      Attachments

        Issue Links

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

          Activity

            People

              crmaurei Cristian Maureira-Fredes
              mossblaser Jonathan Heathcote
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes