I have an application containing a QGraphicsView, which in turn views a QGraphicsScene containing a single customized QGraphicsItem. When the user resizes the application's main window, the QGraphicsView, of course, gets resized as well. When this happens, we would like the QGraphicsItem to repaint itself. It already does this, of course.
The problem is that repainting is inherently slow, involving database lookups and a fair amount of computation before the QGraphicsItem can proceed with painting, a process which can take a few seconds to complete.
So the problem is: when the QGraphicsView resizes, it sends a steady stream of repaint events down to the QGraphicsItem. This causes an abominable delay while the QGraphicsItem attempts to process all of them.
There are many solutions to this problem, but what I'd like to is only propagate resize events when the user lets go of the mouse and the window/QGraphicsView/QGraphicsItem are all at their final size, and only then go through the slow repaint calls. Note that mouseRelease events will take place outside the QGraphicsView, when the user is resizing the main application window.
What is the best way to accomplish this?
Bookmarks