QGraphicsScene is missing a particular item update

随声附和 提交于 2019-12-04 11:34:42

Picking up my comment from above as an answer:

You need to use QGraphicsScene::invalidate(...) to invalidate the parts of the scene that should be redrawn.

I believe this is similar to a problem I have had when working with lots QGraphicsItems. I eventually solved my problem by streamlining the amount of QGraphicsItems I had on the screen at any one time, and to not cache QGraphicsItems that did not need to be cached.

An easy way to check if this is your problem would be:

vehicle->setCacheMode(QGraphicsItem::NoCache);

Which should cause the paint method on your vehicle to be called everytime it needs to be drawn.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!