PDA

View Full Version : Why the Qgraphicsscene has drawbackground event ?????



tonnot
5th September 2011, 18:56
This is the kind of things I dont understand.
As you can read on reference :

Note that QGraphicsScene has no visual appearance of its own; it only manages the items. You need to create a QGraphicsView widget to visualize the scene.

But You have :

void QGraphicsScene::drawBackground ( QPainter * painter, const QRectF & rect ) [virtual protected]
Draws the background of the scene using painter, before any items and the foreground are drawn. Reimplement this function to provide a custom background for the scene.
All painting is done in scene coordinates. The rect parameter is the exposed rectangle.
If all you want is to define a color, texture, or gradient for the background, you can call setBackgroundBrush() instead.
See also drawForeground() and drawItems().

??????
Any explanation ?

wysota
5th September 2011, 20:26
Please download Qt sourcecode, unpack it and have a look at what QGraphicsView::drawBackground() and QGraphicsScene::drawBackground() look like.