[PyQt] can't create a QPainter in QTreeWidget's paintEvent
Devon
devon.rueckner at temboo.com
Thu Aug 23 14:41:32 BST 2007
> > 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
>
> The first thing to look at is whether e is a paint event or not:
>
Yes, it is a paint event. I'm also not calling paintEvent()
explicitly anywhere - it's just being triggered off the main loop.
More information about the PyQt
mailing list