Colliding Mice Qt 4 example question
-
There is a function in mouse.cpp
@void Mouse::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
@I didn't see it being called anywhere so decided to step in main(). The last line in main() is
@return app.exec();@when this line is executed, the code steps into the paint function. Who is sending in the arguments like QPainter* etc?
Also, this function declaration from mouse.cpp has these mysterious pointers without any name, e.g. QStyleOptionGraphicsItem *. I haven't seen that before. What does it mean to just have a pointer and no name?
thanks,
sb -
-
That's a QGraphicsItem, right? The QGraphicsView framework will invoke the paint method every time it is necessary to draw your item, so you don't have to care about that, and will pass to it an initialized QPainter to draw.
[quote]Also, this function declaration from mouse.cpp has these mysterious pointers without any name, e.g. QStyleOptionGraphicsItem *. I haven’t seen that before. What does it mean to just have a pointer and no name?[/quote]
It simply means that you are not going to use those parameters.