[PyQt] can't create a QPainter in QTreeWidget's paintEvent

Devon devon.rueckner at temboo.com
Wed Aug 22 21:49:05 BST 2007


Hi, folks -

Here is a dummy version of a derived tree widget:

----------------------------
class MyTreeWidget(QTreeWidget):
    def __init__(self, parent=None):
        QTreeWidget.__init__(self, parent)

    def paintEvent(self, e):
        QTreeWidget.paintEvent(self, e)
        painter = QPainter(self)
        painter.end()
----------------------------


When an instance is added to a layout, I get the following:

----------------------------
QPainter::begin: Widget painting can only begin as a result of a paintEvent
QPainter::end: Painter not active, aborted
----------------------------

Any ideas what is causing the the painter to think it's not actually
in a paintEvent?

I'm using Qt 4.3.1, PyQt 4.3 and SIP 4.7

Thanks
~ Devon


More information about the PyQt mailing list