Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-86194

AnimatedImage::frameCountChanged is not emitted

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15
    • Quick: Other
    • None

    Description

      I want to show the current frame and frameCount of an AnimatedImage (.gif).
      During the first playback of the gif the frameCount is 0.
      After that the frameCount changes to the actual number of frames but the corresponding signal is never emitted, so the bindings are not updated.
      As a workaround I have the following binding:

      onCurrentFrameChanged: seeker.duration = image.frameCount
      

       

      I tried to fix it, but QMovie doesn't seem to have any relevant signals.
      What worked for me is this (which is obviously not optimal since it runs every frame):

      ------------------- src/quick/items/qquickanimatedimage.cpp -------------------
      index 9de48cbf5f..0a0dc4d277 100644
      @@ -471,6 +471,10 @@ void QQuickAnimatedImage::movieUpdate()
           if (d->movie) {
               d->setPixmap(*d->infoForCurrentFrame(qmlEngine(this)));
               emit QQuickImageBase::currentFrameChanged();
      +        if (d->frameCount != d->movie->frameCount()) {
      +            d->frameCount = d->movie->frameCount();
      +            emit QQuickImageBase::frameCountChanged();
      +        }
           }
       }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            mkrems Marcel Krems
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes