I'm investigating whether it is possible to implement QPaintEngine in
Python, but I have a problem with my test program:

-----------------------------------------------
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import sys

class PaintEngine(QPaintEngine):

    def begin(self, paintdevice):
        self.paintdevice = paintdevice
        return True

    def drawLines(self, lines, count):
        print count, lines

    def end(self):
        return True

class PaintDevice(QPaintDevice):
    def __init__(self):
        QPaintDevice.__init__(self)
        self.engine = PaintEngine()

    def paintEngine(self):
        return self.engine

app = QApplication(sys.argv)

device = PaintDevice()
p = QPainter(device)
p.drawLines( [QLineF(0, 0, 100, 100), QLineF(100,100,200,200)] )
p.drawLine( QLineF(200,200,300,300))
----------------------------------------------

This outputs:

2 PyQt4.QtCore.QLineF(0.0, 0.0, 100.0, 100.0)
1 PyQt4.QtCore.QLineF(200.0, 200.0, 300.0, 300.0)

As far as I can see, from the C++ API the first call to drawLines should pass a list of two QLineF objects, but only one is received.

The C++ documentation says:
 void QPaintEngine::drawLines ( const QLineF * lines, int lineCount )

but the PyQt documentation says:
 QPaintEngine.drawLines (self, QLineF lines, int lineCount)

Shouldn't lines be a list of QLineF objects? is this a mistake in the bindings or am I doing something wrong?

Thanks

Jeremy


--
Jeremy Sanders <[email protected]>
http://www.jeremysanders.net/                Cambridge, UK
Public Key Server PGP Key ID: E1AAE053
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to