PDA

View Full Version : QPainter in QGraphicsScene



mukunda
24th January 2011, 13:03
Can i use QGraphicsScene or QGraphicsItem as the paint device to the QPainter , instead of using it in paint(). The document shows that only widgets like image,picture,etc can be used to paint using painter.
I have a necessity of drawing text for every 1sec for an item. I can draw text in paint(), but it is causing burden on application.

franz
24th January 2011, 17:28
You misunderstand the purpose of QGraphicsScene and QGraphicsItem. They aren't paint devices. Better yet, they work on paint devices (like QWidgets). QGraphicsScene and QGraphicsItem describe the scene and item. They paint themselves onto a paint device.

If the text doesn't change, use QPainter::drawStaticText().