Greetings!
I have subclassed a QGraphicsView so that I can use it in QMainWindow::setCentralWidget() and add some custom implementations.
Now, I am getting some performance problems:
Flickering – the scene needs to update for a specific interval (fast! like realtime) and handles a lot of items (hundreds of it!). This problem is observable when there are too many items to handle or it is too fast.
Disappearing items – most of the items animate which means that it goes in and out of the QGraphicsView::sceneRect(). After it goes “outside”, the item should return but it becomes “invisible” (i use qDebug to show the items location, and it is right inside the sceneRect). It is certainly NOT a problem of the QGraphicsItem. When I zoom out, the item “repaints” correctly.
ScrollBars where SET as hidden but they still show a light gray strip on the right and bottom of the widget
Cannot test is debug mode (in QtC) since it outputs the following “dirtySceneTransform” problem
ASSERT: "!parent->d_ptr->dirtySceneTransform" in file graphicsview\qgraphicsitem.cpp, line 1043
ASSERT: "calledEmitUpdated" in file graphicsview\qgraphicsscene.cpp, line 481
I did some optimizations that I know of like removing antialiasing, using NoIndex, etc. but getting problems when there are too many items to handle.
I need a “perfect” guide in QGraphicsView optimizations and “right way” of subclassing it. Thanks!
PS: If you want to know what I am talking about, you may visit my project at QBox2D-Github [github.com]
or download QTestBed [dropbox.com] built under Qt4.8.4/msvc2012
try to zoom in/out or drag the scene while executing a test
also you may want to test “Tiles” while “Warm Starting” is unchecked then moving the window :(
↧