Problems overriding paintEvent with PySide
I've subclassed the QPlainTextEdit class and have tried to override the paintEvent function so that I can draw a line number area onto it.

    def paintEvent(self, e):
        super(CodeEditor, self).paintEvent(e)
        qp = QtGui.QPainter()
        qp.begin(self)
        self.drawLineNoArea(qp)
        qp.end()

When the program runs I get this output:

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

My best guess is that the function hasn't been overridden properly, but I'm really not sure. Can anybody tell me where I'm going wrong?
Problems overriding paintEvent with PySide
===

I've subclassed the QPlainTextEdit class and have tried to override the paintEvent function so that I can draw a line number area onto it.

    def paintEvent(self, e):
        super(CodeEditor, self).paintEvent(e)
        qp = QtGui.QPainter()
        qp.begin(self)
        self.drawLineNoArea(qp)
        qp.end()

When the program runs I get this output:

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

My best guess is that the function hasn't been overridden properly, but I'm really not sure. Can anybody tell me where I'm going wrong?