Hello,
I am trying to write a roundabout simulator. I have a class inheriting QGraphicsView. Here's the initialization from the constructor:
_scene->setSceneRect(-1000, -1000, 2000, 2000);
setScene(_scene);
setOptimizationFlag(DontAdjustForAntialiasing);
_scene = new QGraphicsScene;
_scene->setSceneRect(-1000, -1000, 2000, 2000);
_scene->setItemIndexMethod(QGraphicsScene::NoIndex);
setScene(_scene);
setCacheMode(QGraphicsView::CacheBackground);
setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
setDragMode(QGraphicsView::ScrollHandDrag);
setOptimizationFlag(DontAdjustForAntialiasing);
To copy to clipboard, switch view to plain text mode
I tried adding some mice from Colliding Mice example. When there are more then twenty (or so) of them, performance drops. I commented out any of my roundabout-drawing code, so now it's just mice on a green background.
I tried simplifying the mouse:
aint() and mouse::advance() functions, but that didn't seem to do the trick.
What is the reason behind the slowdown? I wanted to have many more cars moving (and detecting collisions) then twenty
should I use different approach then GraphicsView?
Bookmarks