I have two scenarios.

In first scenario: I added a QFrame in QWidget (acting as my mainwindow). I have a function drawline(). I call this function in QFrame:aintevent(). This works fine without any errors and lines are drawn.


In the second scenario, I am drawing on a QFrame after receiving response from my server.
My QFrame is add into MainWindow. When I call my draw function (outside QFrame's paintevent), I get the following errors:

QPainter::begin: Paint device returned engine == 0, type: 1
drawing lines w/o painter
QPainter::setPen: Painter not active
QPainter::setPen: Painter not active
QPainter::setPen: Painter not active
QPainter::setPen: Painter not active


Can anyone help me in solving the problem?

thanks