[Qt-interest] Loading gif animation on a qgraphicsview
John McClurkin
jwm at nei.nih.gov
Thu Sep 24 15:28:46 CEST 2009
Andreas Unger wrote:
> Hello all,
>
> I'm building a cross-platform application that must work consistently on
> Windows and Linux OSes. I have a Qgraphicsview with a scene to which I
> add and remove widgets. now some times, it takes long for the processing
> of all the widgets to be loaded into the scene to take place, so I need
> to add an animated gif to the scene such that while the other widgets
> are being loaded, the user can get visual feedback that some processing
> is taking place.
>
> However, I'm at loss on how to do this, I can load an animated gif on a
> Qlabel by doing qlabel->setMovie(QMovie *movie) but I can't have the
> animation going while concurrently processing other gui events. What I
> first tried to do is, when the user clicks a button, I start a new
> QThread that emits a signal, and the main window has a slot which is
> connected to the signal emitted by the thread and this slot starts the
> gif animation movie. however, this doesn't work.
>
> can someone please give me some tips or point me to some example source
> code?
>
> best regards,
> Andreas
Where are you loading the widgets? In the main gui thread? In a second
thread?
If you are loading widgets in the main thread, the event loop will be
blocked and the entire GUI will be unresponsive. In this case, you need
to call QApplication::processEvents() periodically while loading the
widgets.
More information about the Qt-interest-old
mailing list