QGraphicsItem paint event called continually during QWidget::event loop
-
So now it's working as you want ?
-
No the paint method is still being called repeatedly for each rectangle in the scene, which is time consuming. I only want paint to be called when something changes in the rectangle like when it is moved or the color is changed. It may be that I am misunderstanding when the paint method is triggered. Is it supposed to be triggered at every QWidget event? Because that is what seems to be happening right now.
-
One other detail, you are not calling the correct base class implementation of MainWindow.
Also, do you really need Frame ? Looks like you could put the QGraphicsView directly as central widget, no ?
-
In
MainWindow::event, you are not callingQMainWindow::eventbutQWidget::event. -
What else are you doing in your application ?
-
We have a palette of icons in a dock widget that the user can add into the scene, copy, paste and delete. Each graphics item has a proxy widget that holds properties for the item. The items are rectangles and lines that connect between them so that moving a rectangle should move the lines that are connected to it. I want the items to update at a reasonable event, for example a mouse release event, instead of repeatedly like they doing now which is causing some lag. Basically I want to install an event filter, but am first trying to understand why all QMainWindow events are triggering a graphics item paint.
-
By proxy do you mean you have QProxyGraphicsProxyWidget ?
-
How many are they at once on your scene ?
-
Are you still experiencing that if you avoid the proxy widgets ?
-
Is the code accessible somewhere to be tested ?
-
Glad you found out and thanks for sharing !
Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)