[PyKDE] Problems with QWMatrix and QCanvasView

Henrik Motakef henrik.motakef at web.de
Thu Aug 23 11:38:46 BST 2001


Hi,

I want to create a QCanvasView which shows a "zoomed" version of it's Canvas. What I tried looked like this:

class ZoomedCanvasView(QCanvasView):
    def __init__(self, canvas, parent):
        QCanvasView.__init__(self, canvas, parent)
        matrix = self.matrix = QWMatrix()
        matrix.scale(2,2)

    def drawContents(self, painter, cx, cy, cw, ch):
        painter.setWorldMatrix(self.matrix)
        QCanvasView.drawContents(self, painter, cx, cy, cw, ch)

Unfortunately this doesn't work, in several ways: First, the last four parameters are not always passed, so an exception "Wrong number of arguments" is raised (This usually happens only in the first call of drawContents). However, when I change it to something like

   def drawContents(*args):
       ...
       apply(QCanvasView.drawContents, args)

another exception, "parameter 2 has wrong type", is raised - but not always. The third kind of error is not raising an exception at all, but simply not redrawing the CanvasItems properly after they scrolled out of the viewport an in again.

Is this a bug, or am I doing something terribly wrong?

Regards
Henrik Motakef

_______________________________________________________________________
1.000.000 DM gewinnen - kostenlos tippen - http://millionenklick.web.de
IhrName at web.de, 8MB Speicher, Verschluesselung - http://freemail.web.de






More information about the PyQt mailing list