tonnot
tonnot

Reputation: 455

Qt QGraphicsScene::drawItems subsitute?

For QGraphicsScene::drawItems the reference says:

Reimplement this function to provide custom painting of all items for the scene; gaining complete control over how each item is drawn.

But this function is marked as obsolete. Is there any new equivalent method?

Upvotes: 2

Views: 590

Answers (1)

Tim Meyer
Tim Meyer

Reputation: 12600

QGraphicsView::paintEvent() now calls

d->scene->d_func()->drawItems()

which means the method is part of class QGraphicsScenePrivate which you cannot override afaik.

If you need to change the way your items are drawn, first try to think of another way (i.e. a solution which does not require stepping into the drawItems() method). If you can't find any solution like that, your only chance is reactivating the pre-4.6-behaviour by setting

QGraphicsView::setOptimizationFlag( QGraphicsView::IndirectPainting )

Upvotes: 1

Related Questions