diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2013-12-02 22:32:51 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-03 12:29:44 +0100 |
commit | 1d684b38a4fb0b8ce33401fa9c8f415eba6097bf (patch) | |
tree | 3f0a8ffc1e2533485055ef18461bfcec9d0fd6f5 | |
parent | 78c8e7d9a7860c15f907615f2b02b3986a080d2a (diff) | |
download | qtquickcontrols-1d684b38a4fb0b8ce33401fa9c8f415eba6097bf.tar.gz |
Fix desktop style animations to stop when the control is hiddenv5.2.0
QStyleAnimation automatically stopped for hidden QWidgets, but didn't
know anything about QQuickItems and kept animating regardless of their
visibility. QStyleAnimation was changed so that it will keep animating
only as long as the animation target accepts animation updates. This
change ensures that the style animation updates are accepted only when
the control is visible.
Note: In order to restart such style animations, QQuickStyleItem needs
to be manually updated when it becomes visible.
Task-number: QTBUG-35319
Change-Id: Ia053912883b9babb184a5467adfc90dd619b3dc5
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
-rw-r--r-- | src/controls/Private/qquickstyleitem.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/controls/Private/qquickstyleitem.cpp b/src/controls/Private/qquickstyleitem.cpp index 566a46f8..0210e76e 100644 --- a/src/controls/Private/qquickstyleitem.cpp +++ b/src/controls/Private/qquickstyleitem.cpp @@ -211,6 +211,7 @@ QQuickStyleItem::QQuickStyleItem(QQuickItem *parent) setFlag(QQuickItem::ItemHasContents, true); setSmooth(false); + connect(this, SIGNAL(visibleChanged()), this, SLOT(updateItem())); connect(this, SIGNAL(widthChanged()), this, SLOT(updateItem())); connect(this, SIGNAL(heightChanged()), this, SLOT(updateItem())); connect(this, SIGNAL(enabledChanged()), this, SLOT(updateItem())); @@ -1616,7 +1617,10 @@ bool QQuickStyleItem::hasThemeIcon(const QString &icon) const bool QQuickStyleItem::event(QEvent *ev) { if (ev->type() == QEvent::StyleAnimationUpdate) { - polish(); + if (isVisible()) { + ev->accept(); + polish(); + } return true; } else if (ev->type() == QEvent::StyleChange) { if (m_itemType == ScrollBar) |