diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2013-12-02 22:23:11 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-04 09:11:28 +0100 |
commit | ac54abfb07579c747612c0d9e53089fe5cd32caf (patch) | |
tree | cc6cf21bdcb8674f5eecb18705bbc3f01a4d9296 /src/widgets/graphicsview | |
parent | 1fc28716e67cb9a4384c99c39e8a283ca344e771 (diff) |
Fix style animations to stop when the animation target is hidden
QStyleAnimation automatically stopped for hidden QWidgets, but didn't
know anything about QQuickItems and kept animating regardless of their
visibility. This change ensures that style animations stop as soon as
the animation target no longer accepts the animation update eg. it has
become hidden or the window was minimized.
Task-number: QTBUG-35319
Change-Id: Ie48191fd918c626c0d9afe2e7d2390c495efb071
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/widgets/graphicsview')
-rw-r--r-- | src/widgets/graphicsview/qgraphicsitem.cpp | 5 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicswidget.cpp | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index fffc805637..0ba0889b58 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -7634,7 +7634,10 @@ QGraphicsObject::~QGraphicsObject() bool QGraphicsObject::event(QEvent *ev) { if (ev->type() == QEvent::StyleAnimationUpdate) { - update(); + if (isVisible()) { + ev->accept(); + update(); + } return true; } return QObject::event(ev); diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp index 4abb5e39e5..ccc51120a9 100644 --- a/src/widgets/graphicsview/qgraphicswidget.cpp +++ b/src/widgets/graphicsview/qgraphicswidget.cpp @@ -1409,9 +1409,14 @@ bool QGraphicsWidget::event(QEvent *event) break; case QEvent::WindowActivate: case QEvent::WindowDeactivate: - case QEvent::StyleAnimationUpdate: update(); break; + case QEvent::StyleAnimationUpdate: + if (isVisible()) { + event->accept(); + update(); + } + break; // Taken from QWidget::event case QEvent::ActivationChange: case QEvent::EnabledChange: |