Way to know when QGraphicsView is finished rendering?
-
I'm drawing several pixmaps in a QGraphicsView and need to put up a busy cursor until it's done.
Problem is I haven't found a reliable way to know when this is - can't find a signal or event to intercept.
I overloaded the paint() event, noticing that I was getting a paint event per pixmap. However, it's not consistent - sometimes I get fewer than expected paint() events. Apparently, it can draw more than one pixmap per event.
So, that didn't work.
Anyone know of a way to detect when QGraphicsView is done rendering?
Thanks,
rickb -
My understanding is that the notion of "done rendering" really translates to "there are no more paint events for this QGraphicsView in the queue," so there's not any sort of signal thrown like you are wanting. Could you just spin until there are no pending events at all?
-
Interesting thought. The problem I think is that something else might force a redraw - I'm only interested in the first one. Subsequent draws are fast. (Actually, the issue is I'm downloading images one at a time, but they get downloaded way before they get drawn...)
Seems like QGraphicsView has to traverse all of the items in the scene - there ought to be a 'begin traverse' and 'end traverse' notification, somewhere, I would think (a not untypical scenegraph feature - OpenInventor, for instance))
-
Looking at the code for the render() function in 4.7, it doesn't look like there are any signals being emitted during the process. Maybe there is something in the objects themselves?
-
You are not downloading the images from the drawing code, are you?
-
[quote author="Chris H" date="1323784331"]Looking at the code for the render() function in 4.7, it doesn't look like there are any signals being emitted during the process. Maybe there is something in the objects themselves?[/quote]
Right - nor is the 'render()' function virtual, so you can't override it.
[quote author="Andre" date="1323787413"]You are not downloading the images from the drawing code, are you?[/quote]
Nope.