I have searched some solution for my problem and nothing... I'm using a QMovie with a GIF animation in one QLabel for a loading status, ok? It's simple and i learned in this link: GIF animation in Qt, this works perfectly when i open a menu, for example, than owns one label and i put the QMovie in a QLabel of that menu.
My problem now is, i made a specific UI for loading status, when i know than some UI will be slow to open, i would show my loading status UI and when the UI ends to open i would close my loading status UI. In this loading status UI i puted one QMovie (GIF animation) and a simple QLabel written 'Loading...', very simple, right? Buuuut, when i use this specific UI, the QMovie does not work. In fact it does not stay in looping... See, when i use the QMovie in the UI than i am opening, the QMovie stays in looping.
My english is not so good, but do you understand my problem? =/
I'm using the same code of the link:
this->m_pMovie = new QMovie(":/ui/images/my_image_loading.gif");
this->m_pMovie->setScaledSize(QSize(50, 50));
this->ui->labelImageLoading->setMovie(this->m_pMovie);
this->m_pMovie->start();
Someone know about that?
Thank you...
Everything looks fine in how you are using the QMovie. This is just a guess, but I'm wondering if your QMovie is not being updated because the GUI thread is too busy. If you have a UI that is slow to load, that slowness might be because it is consuming a lot of processing on the GUI thread. This is the same thread that is trying to update your QMovie. The result: your QMovie is never updated because it is dependent upon the same GUI thread to get its updates painted.
If there is anywhere in the UI loading process where you could put a few calls to QApplication::processEvents()
, that would get the movie to update. But it might be choppy.
Otherwise, there is really not much you can do except try to find a way to make those UIs load faster. (Separate them into different windows, simply the layouts, break into tabs that load as-needed, etc.)