In Qt 4.1 I get the following error when trying to use QPainter in a function in a QLineEdit derived class:


QWidget::paintEngine() should no longer be called
QPainter::begin(), paintdevice returned engine == 0, type: 1



This is on Linux and I have tried to set:

Qt Code:
  1. setAttribute( Qt::WA_PaintOutsidePaintEvent, true );
To copy to clipboard, switch view to plain text mode 

as this painting is not happening in the paintEvent() function.

The line that triggers the message is:

Qt Code:
  1. QPainter painter(this);
To copy to clipboard, switch view to plain text mode 

Nothing is painted using the painter. Is this not possible to do or how could I paint in this function ?