From 234171e753525e6a95ba800d7e53380f88d91398 Mon Sep 17 00:00:00 2001 From: Rob Scheepmaker Date: Fri, 11 Apr 2008 14:26:07 +0000 Subject: [PATCH] Added the isAnimating() function to Phase. This way, applet/widgets can delay 'heavy' operations until all animations are finished to avoid stuttering animations. svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=795821 --- phase.cpp | 9 +++++++++ phase.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/phase.cpp b/phase.cpp index 106b87356..bfd4d844d 100644 --- a/phase.cpp +++ b/phase.cpp @@ -489,6 +489,15 @@ QPixmap Phase::animationResult(AnimId id) return state->pixmap; } +//returns true if there are animations happening. +bool Phase::isAnimating() +{ + return (d->animatedItems.size() > 0 || + d->movingItems.size() > 0 || + d->animatedItems.size() > 0 || + d->customAnims.size() > 0); +} + void Phase::timerEvent(QTimerEvent *event) { Q_UNUSED(event) diff --git a/phase.h b/phase.h index ec02d81f2..c5dcafe11 100644 --- a/phase.h +++ b/phase.h @@ -116,6 +116,8 @@ public: Q_INVOKABLE void setAnimationPixmap(AnimId id, const QPixmap &pixmap); Q_INVOKABLE QPixmap animationResult(AnimId id); + Q_INVOKABLE bool isAnimating(); + Q_SIGNALS: void animationComplete(QGraphicsItem *item, Plasma::Phase::Animation anim); void movementComplete(QGraphicsItem *item);