diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-02-21 10:41:54 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-02-26 07:13:18 +0000 |
commit | 499ec43937e926e4f2fa57a9baa455fcb3862262 (patch) | |
tree | 206c90d47387f8322b68f5e3db613189397e1af3 /src/qml/animations | |
parent | 53d1e9ed21d25e65a2f13606af479838f5f21fe7 (diff) |
use nullptr consistently (clang-tidy)
From now on we prefer nullptr instead of 0 to clarify cases where
we are assigning or testing a pointer rather than a numeric zero.
Also, replaced cases where 0 was passed as Qt::KeyboardModifiers
with Qt::NoModifier (clang-tidy replaced them with nullptr, which
waas wrong, so it was just as well to make the tests more readable
rather than to revert those lines).
Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/animations')
-rw-r--r-- | src/qml/animations/qabstractanimationjob.cpp | 8 | ||||
-rw-r--r-- | src/qml/animations/qanimationgroupjob.cpp | 18 | ||||
-rw-r--r-- | src/qml/animations/qsequentialanimationgroupjob.cpp | 10 | ||||
-rw-r--r-- | src/qml/animations/qsequentialanimationgroupjob_p.h | 2 |
4 files changed, 19 insertions, 19 deletions
diff --git a/src/qml/animations/qabstractanimationjob.cpp b/src/qml/animations/qabstractanimationjob.cpp index b726d2fc43..3f33e7e81b 100644 --- a/src/qml/animations/qabstractanimationjob.cpp +++ b/src/qml/animations/qabstractanimationjob.cpp @@ -258,7 +258,7 @@ int QQmlAnimationTimer::closestPauseAnimationTimeToFinish() QAbstractAnimationJob::QAbstractAnimationJob() : m_loopCount(1) - , m_group(0) + , m_group(nullptr) , m_direction(QAbstractAnimationJob::Forward) , m_state(QAbstractAnimationJob::Stopped) , m_totalCurrentTime(0) @@ -266,9 +266,9 @@ QAbstractAnimationJob::QAbstractAnimationJob() , m_currentLoop(0) , m_uncontrolledFinishTime(-1) , m_currentLoopStartTime(0) - , m_nextSibling(0) - , m_previousSibling(0) - , m_wasDeleted(0) + , m_nextSibling(nullptr) + , m_previousSibling(nullptr) + , m_wasDeleted(nullptr) , m_hasRegisteredTimer(false) , m_isPause(false) , m_isGroup(false) diff --git a/src/qml/animations/qanimationgroupjob.cpp b/src/qml/animations/qanimationgroupjob.cpp index ea6d87952a..344791fd83 100644 --- a/src/qml/animations/qanimationgroupjob.cpp +++ b/src/qml/animations/qanimationgroupjob.cpp @@ -42,7 +42,7 @@ QT_BEGIN_NAMESPACE QAnimationGroupJob::QAnimationGroupJob() - : QAbstractAnimationJob(), m_firstChild(0), m_lastChild(0) + : QAbstractAnimationJob(), m_firstChild(nullptr), m_lastChild(nullptr) { m_isGroup = true; } @@ -111,25 +111,25 @@ void QAnimationGroupJob::removeAnimation(QAbstractAnimationJob *animation) else m_lastChild = prev; - animation->m_previousSibling = 0; - animation->m_nextSibling = 0; + animation->m_previousSibling = nullptr; + animation->m_nextSibling = nullptr; - animation->m_group = 0; + animation->m_group = nullptr; animationRemoved(animation, prev, next); } void QAnimationGroupJob::clear() { QAbstractAnimationJob *child = firstChild(); - QAbstractAnimationJob *nextSibling = 0; - while (child != 0) { - child->m_group = 0; + QAbstractAnimationJob *nextSibling = nullptr; + while (child != nullptr) { + child->m_group = nullptr; nextSibling = child->nextSibling(); delete child; child = nextSibling; } - m_firstChild = 0; - m_lastChild = 0; + m_firstChild = nullptr; + m_lastChild = nullptr; } void QAnimationGroupJob::resetUncontrolledAnimationsFinishTime() diff --git a/src/qml/animations/qsequentialanimationgroupjob.cpp b/src/qml/animations/qsequentialanimationgroupjob.cpp index 25d31e4042..22e20d9268 100644 --- a/src/qml/animations/qsequentialanimationgroupjob.cpp +++ b/src/qml/animations/qsequentialanimationgroupjob.cpp @@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE QSequentialAnimationGroupJob::QSequentialAnimationGroupJob() : QAnimationGroupJob() - , m_currentAnimation(0) + , m_currentAnimation(nullptr) , m_previousLoop(0) { } @@ -87,7 +87,7 @@ QSequentialAnimationGroupJob::AnimationIndex QSequentialAnimationGroupJob::index Q_ASSERT(firstChild()); AnimationIndex ret; - QAbstractAnimationJob *anim = 0; + QAbstractAnimationJob *anim = nullptr; int duration = 0; for (anim = firstChild(); anim; anim = anim->nextSibling()) { @@ -283,7 +283,7 @@ void QSequentialAnimationGroupJob::setCurrentAnimation(QAbstractAnimationJob *an { if (!anim) { Q_ASSERT(!firstChild()); - m_currentAnimation = 0; + m_currentAnimation = nullptr; return; } @@ -364,7 +364,7 @@ void QSequentialAnimationGroupJob::uncontrolledAnimationFinished(QAbstractAnimat void QSequentialAnimationGroupJob::animationInserted(QAbstractAnimationJob *anim) { - if (m_currentAnimation == 0) + if (m_currentAnimation == nullptr) setCurrentAnimation(firstChild()); // initialize the current animation if (m_currentAnimation == anim->nextSibling() @@ -393,7 +393,7 @@ void QSequentialAnimationGroupJob::animationRemoved(QAbstractAnimationJob *anim, else if (prev) setCurrentAnimation(prev); else// case all animations were removed - setCurrentAnimation(0); + setCurrentAnimation(nullptr); } // duration of the previous animations up to the current animation diff --git a/src/qml/animations/qsequentialanimationgroupjob_p.h b/src/qml/animations/qsequentialanimationgroupjob_p.h index 5fbafcb9ac..c7023b77c6 100644 --- a/src/qml/animations/qsequentialanimationgroupjob_p.h +++ b/src/qml/animations/qsequentialanimationgroupjob_p.h @@ -77,7 +77,7 @@ protected: private: struct AnimationIndex { - AnimationIndex() : afterCurrent(false), timeOffset(0), animation(0) {} + AnimationIndex() : afterCurrent(false), timeOffset(0), animation(nullptr) {} // AnimationIndex points to the animation at timeOffset, skipping 0 duration animations. // Note that the index semantic is slightly different depending on the direction. bool afterCurrent; //whether animation is before or after m_currentAnimation //TODO: make enum Before/After/Same |