diff options
Diffstat (limited to 'src/corelib/animation')
-rw-r--r-- | src/corelib/animation/qabstractanimation.cpp | 16 | ||||
-rw-r--r-- | src/corelib/animation/qabstractanimation_p.h | 2 | ||||
-rw-r--r-- | src/corelib/animation/qanimationgroup_p.h | 2 | ||||
-rw-r--r-- | src/corelib/animation/qpropertyanimation_p.h | 2 | ||||
-rw-r--r-- | src/corelib/animation/qsequentialanimationgroup_p.h | 2 |
5 files changed, 12 insertions, 12 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index b507049cc4..0be37b7dca 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -152,6 +152,7 @@ #include <QtCore/qthreadstorage.h> #include <QtCore/qcoreevent.h> #include <QtCore/qpointer.h> +#include <QtCore/qscopedvaluerollback.h> #define DEFAULT_TIMER_INTERVAL 16 #define PAUSE_TIMER_COARSE_THRESHOLD 2000 @@ -315,14 +316,13 @@ void QUnifiedTimer::updateAnimationTimers(qint64 currentTick) //* it might happen in some cases that the delta is negative because the animation driver // advances faster than time.elapsed() if (delta > 0) { - insideTick = true; + QScopedValueRollback<bool> guard(insideTick, true); if (profilerCallback) profilerCallback(delta); for (currentAnimationIdx = 0; currentAnimationIdx < animationTimers.count(); ++currentAnimationIdx) { QAbstractAnimationTimer *animation = animationTimers.at(currentAnimationIdx); animation->updateAnimationsTime(delta); } - insideTick = false; currentAnimationIdx = 0; } } @@ -361,10 +361,11 @@ void QUnifiedTimer::localRestart() void QUnifiedTimer::restart() { - insideRestart = true; - for (int i = 0; i < animationTimers.count(); ++i) - animationTimers.at(i)->restartAnimationTimer(); - insideRestart = false; + { + QScopedValueRollback<bool> guard(insideRestart, true); + for (int i = 0; i < animationTimers.count(); ++i) + animationTimers.at(i)->restartAnimationTimer(); + } localRestart(); } @@ -599,14 +600,13 @@ void QAnimationTimer::updateAnimationsTime(qint64 delta) //it might happen in some cases that the time doesn't change because events are delayed //when the CPU load is high if (delta) { - insideTick = true; + QScopedValueRollback<bool> guard(insideTick, true); for (currentAnimationIdx = 0; currentAnimationIdx < animations.count(); ++currentAnimationIdx) { QAbstractAnimation *animation = animations.at(currentAnimationIdx); int elapsed = QAbstractAnimationPrivate::get(animation)->totalCurrentTime + (animation->direction() == QAbstractAnimation::Forward ? delta : -delta); animation->setCurrentTime(elapsed); } - insideTick = false; currentAnimationIdx = 0; } } diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h index 3b6e8d6cc4..037d3be74f 100644 --- a/src/corelib/animation/qabstractanimation_p.h +++ b/src/corelib/animation/qabstractanimation_p.h @@ -78,7 +78,7 @@ public: hasRegisteredTimer(false), isPause(false), isGroup(false), - group(0) + group(nullptr) { } diff --git a/src/corelib/animation/qanimationgroup_p.h b/src/corelib/animation/qanimationgroup_p.h index ff759d11fd..215734b656 100644 --- a/src/corelib/animation/qanimationgroup_p.h +++ b/src/corelib/animation/qanimationgroup_p.h @@ -76,7 +76,7 @@ public: void disconnectUncontrolledAnimation(QAbstractAnimation *anim) { //0 for the signal here because we might be called from the animation destructor - QObject::disconnect(anim, 0, q_func(), SLOT(_q_uncontrolledAnimationFinished())); + QObject::disconnect(anim, nullptr, q_func(), SLOT(_q_uncontrolledAnimationFinished())); } void connectUncontrolledAnimation(QAbstractAnimation *anim) diff --git a/src/corelib/animation/qpropertyanimation_p.h b/src/corelib/animation/qpropertyanimation_p.h index 479762f573..cbd3ce287d 100644 --- a/src/corelib/animation/qpropertyanimation_p.h +++ b/src/corelib/animation/qpropertyanimation_p.h @@ -64,7 +64,7 @@ class QPropertyAnimationPrivate : public QVariantAnimationPrivate Q_DECLARE_PUBLIC(QPropertyAnimation) public: QPropertyAnimationPrivate() - : targetValue(0), propertyType(0), propertyIndex(-1) + : targetValue(nullptr), propertyType(0), propertyIndex(-1) { } diff --git a/src/corelib/animation/qsequentialanimationgroup_p.h b/src/corelib/animation/qsequentialanimationgroup_p.h index 88dac4f566..c082d6b524 100644 --- a/src/corelib/animation/qsequentialanimationgroup_p.h +++ b/src/corelib/animation/qsequentialanimationgroup_p.h @@ -63,7 +63,7 @@ class QSequentialAnimationGroupPrivate : public QAnimationGroupPrivate Q_DECLARE_PUBLIC(QSequentialAnimationGroup) public: QSequentialAnimationGroupPrivate() - : currentAnimation(0), currentAnimationIndex(-1), lastLoop(0) + : currentAnimation(nullptr), currentAnimationIndex(-1), lastLoop(0) { } |