View Full Version : Help on QGraphicsItem::paint please

19th June 2011, 15:27

My QGraphicsScene has a scroll bar. When I scroll it, the QGraphicsItem::paint option's exposedRect is always fixed to the viewport's size, I have to redraw the entire item even though most of the item has not changed.

What I hope is to only redraw the exposed part of the item when scroll bar is moved, because it takes a lot of time to draw the item.

I have used
QGraphicsView::setViewportUpdateMode( QGraphicsView::MinimalViewportUpdate );

Any suggestions please?

18th July 2011, 09:11
Have you set the QGraphicsItem Flag:

setFlag(QGraphicsItem::ItemUsesExtendedStyleOption );

It's mentioned in the doc that the exposedRect member depend on it