diff options
Diffstat (limited to 'src/imports/controls/universal/qquickuniversalprogressring.cpp')
-rw-r--r-- | src/imports/controls/universal/qquickuniversalprogressring.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/imports/controls/universal/qquickuniversalprogressring.cpp b/src/imports/controls/universal/qquickuniversalprogressring.cpp index 2fe66047..38931525 100644 --- a/src/imports/controls/universal/qquickuniversalprogressring.cpp +++ b/src/imports/controls/universal/qquickuniversalprogressring.cpp @@ -53,11 +53,11 @@ class QQuickUniversalProgressRingAnimatorJob : public QQuickAnimatorJob public: QQuickUniversalProgressRingAnimatorJob(); - void initialize(QQuickAnimatorController *controller) Q_DECL_OVERRIDE; - void updateCurrentTime(int time) Q_DECL_OVERRIDE; - void writeBack() Q_DECL_OVERRIDE; - void nodeWasDestroyed() Q_DECL_OVERRIDE; - void afterNodeSync() Q_DECL_OVERRIDE; + void initialize(QQuickAnimatorController *controller) override; + void updateCurrentTime(int time) override; + void writeBack() override; + void nodeWasDestroyed() override; + void afterNodeSync() override; private: struct Phase { @@ -73,7 +73,7 @@ private: Phase m_phases[PhaseCount]; }; -QQuickUniversalProgressRingAnimatorJob::QQuickUniversalProgressRingAnimatorJob() : m_node(Q_NULLPTR) +QQuickUniversalProgressRingAnimatorJob::QQuickUniversalProgressRingAnimatorJob() : m_node(nullptr) { m_phases[0] = Phase(433, -110, 10, QEasingCurve::BezierSpline); m_phases[1] = Phase(767, 10, 93, QEasingCurve::Linear ); @@ -121,7 +121,7 @@ void QQuickUniversalProgressRingAnimatorJob::updateCurrentTime(int time) if (visible) { int phaseIndex, remain = time, elapsed = 0; - for (phaseIndex = 0; phaseIndex < PhaseCount; ++phaseIndex) { + for (phaseIndex = 0; phaseIndex < PhaseCount - 1; ++phaseIndex) { if (remain <= m_phases[phaseIndex].duration + begin) break; remain -= m_phases[phaseIndex].duration; @@ -153,7 +153,7 @@ void QQuickUniversalProgressRingAnimatorJob::writeBack() void QQuickUniversalProgressRingAnimatorJob::nodeWasDestroyed() { - m_node = Q_NULLPTR; + m_node = nullptr; } void QQuickUniversalProgressRingAnimatorJob::afterNodeSync() @@ -191,11 +191,12 @@ int QQuickUniversalProgressRing::count() const void QQuickUniversalProgressRing::setCount(int count) { - if (m_count != count) { - m_count = count; - update(); - emit countChanged(); - } + if (m_count == count) + return; + + m_count = count; + update(); + emit countChanged(); } QColor QQuickUniversalProgressRing::color() const @@ -205,11 +206,12 @@ QColor QQuickUniversalProgressRing::color() const void QQuickUniversalProgressRing::setColor(const QColor &color) { - if (m_color != color) { - m_color = color; - update(); - emit colorChanged(); - } + if (m_color == color) + return; + + m_color = color; + update(); + emit colorChanged(); } QSGNode *QQuickUniversalProgressRing::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) |