About QMovie : play gif animation only once
-
Hi
Animated gifs have done that since the beginning of time (almost) but yeah
would be nice if Docs mentioned that it does honor the loop count in the header, but provides no api to control it :) -
@mrjj If someone wants to propose something for the Documentation, he/she must report at https://bugreports.qt.io/ or there is nothing that can be done?
-
@Petross404_Petros-S
That would be the correct place as it also accepts feature requests and
documents updates. -
@Petross404_Petros-S
Btw, i assumed you need to use various GIFs you cant know before hand
as else i would just have suggested to open the GIF in online editor and set loop count to 1
and it would only play once. -
i would just have suggested to open the GIF in online editor and set loop count to 1
I had done exactly that at https://ezgif.com/, before JKSH wrote the post about
frameChanged
:)I find it a cleaner solution to control the loop with the Qt API (even with bloated -if that's the word- code), rather that duck the issue with external tools. It's just me, it might be better to do this without all that trouble.
-
@Petross404_Petros-S
Hehe funny enough thats the site i would have suggested :)
Yeah fixing it with code is better than fixing one file.
Then if GIF changes it still works. -
@Petross404_Petros-S said in About QMovie : play gif animation only once:
*
frameCount
returns 20 for the specific gif file, but for some reason I must stop at frame #19.If
frameCount()
== 20, thencurrentFrameNumber()
ranges from 0 to 19. It's like an array: If an array has 20 elements, then its last valid index is 19.Nonetheless, even if you used
== movie->frameCount()
, I'd expect your movie to just loop forever instead of crash. Check your stack trace; there might be other issues in your application.** What boggled my mind is that
QMovie::stop()
doesn't emitfinished
as I expected from the description in Detailed Description.This sounds like a bug. I verified (with Qt 5.10.0 MSVC 2015 x86) that it does emit
stateChanged(QMovie::NotRunning)
but doesn't emitfinished()
. Could you please file a separate bug report for this?Please post the links to both reports (documentation and missing
finished()
signal) here, thanks! -
@JKSH Sure I will. I didn't know that not emitting
finished
is a bug (although I suspected it) and I mentioned it in the documentation bug report too. I will report the missing signal tomorrow morning.Also, the whole
frameCount - 1
thing reminded me the arrays and now you confirmed it. I will retry to crash it and see what you are talking about. Thank you all for the support. :) -
Good morning (or whatever in your local time zone is), here is the bug report for the missing signal.