PDA

View Full Version : How to redraw QGraphicsScene background in running



wisconxing
16th November 2008, 02:55
In my QGraphicsScene object declare, I have draw a picture in drawBackground(), see below:

class MyScene : public QGraphicsScene
{
public:
MyScene(qreal x, qreal y, qreal w, qreal h)
: QGraphicsScene(x, y, w, h) { }

protected:
void drawBackground(QPainter *painter, const QRectF &rect)
{ //draw an old background
};

In my program running, I need redraw the background, how I will do?
Very Thanks

wysota
16th November 2008, 09:44
Call QGraphicsScene::invalidate() with QGraphicsScene::BackgroundLayer.

wisconxing
17th November 2008, 08:58
Thank you. But I not understand. Do you give me a particular explain or a source code

wysota
17th November 2008, 13:10
Follow the link in my post.