diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-04-23 17:05:26 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-04-24 10:24:58 +0200 |
commit | af521a8df6caec41f626a4b3319601c20adff711 (patch) | |
tree | fec25e4f642f55e842b3c9e0807de3579ce02d90 /src/quick/items/qquickanimatedsprite_p.h | |
parent | 119be2f769a1fee1ef115ee99a239264e2daff71 (diff) |
Resume AnimatedSprite playback when visibility changes
Amends f5e2783 that was made in 5.6 to avoid updating the AnimatedSprite
when not visible. The problem is, if the sprite was running, the
expectation is that becoming visible again resumes the playback.
It can be argued what the correct behavior is: do we expect the playback
to resume from the point when the sprite went invisible, or should it
take the time spent as invisible into account? This patch only corrects
the immediate problem and provides the former, i.e. playback will resume
from the point it had when becoming invisible.
The AnimatedSprite scene in the imageelements example is improved to be
able to test this. It can also exercise all the start/pause/resume/advance
functions now.
Fixes: QTBUG-63942
Pick-to: 5.15
Change-Id: Ieb6d046168a2132659848a36ee0b694c580159b1
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/quick/items/qquickanimatedsprite_p.h')
-rw-r--r-- | src/quick/items/qquickanimatedsprite_p.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/quick/items/qquickanimatedsprite_p.h b/src/quick/items/qquickanimatedsprite_p.h index 77147add16..e231d2a10d 100644 --- a/src/quick/items/qquickanimatedsprite_p.h +++ b/src/quick/items/qquickanimatedsprite_p.h @@ -184,6 +184,8 @@ protected Q_SLOTS: protected: void componentComplete() override; QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override; + void itemChange(ItemChange, const ItemChangeData &) override; + private: void maybeUpdate(); bool isCurrentFrameChangedConnected(); |