PDA

View Full Version : drawBackground function.....



dreamer
23rd April 2008, 22:51
I'd like to know how this function operate:

void drawBackground(QPainter *painter, const QRectF &rect);

I Know that this function is called when a repaint event is being.
Now.....what kind of settings has the painter?
How can I set them? and the rect?

I also don't understand why the "scene->setBackgroundBrush()" doesn't work when the virtual function drawBackground() is reimplemented(in a scene or view subclass).....

I'd also like to have some examples.....

excuse me for my poor english, i hope that you can understand me!!! Thanks a lot.

wysota
23rd April 2008, 22:54
How about taking a look at documentation of QPainter, QRectF and QGraphicsScene::drawBackground()?

dreamer
23rd April 2008, 23:03
I forget to tell you that i saw a lot of times the reference........

wysota
23rd April 2008, 23:34
Do not look at it - read it :)

I can only repeat what is written there especially that I don't know what exactly you want to know. Read the docs and when you have specific questions, ask them.

As for the only specific (yet trivial) question I see:

I also don't understand why the "scene->setBackgroundBrush()" doesn't work when the virtual function drawBackground() is reimplemented(in a scene or view subclass).....
Because the background brush is used by the default implementation of drawBackground(), so when you reimplement it without calling the base class explicitely, it won't be used.

dreamer
24th April 2008, 08:28
;)

the bakgroundbrush works if a call the base class

QGraphicsScene::drawBackground(QPainter *painter, const QRectF &rect);

...thx