diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-08-09 23:22:22 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-08-10 07:51:05 +0000 |
commit | 320346d7dcc03afe4900bb496cabc6c7f885c01d (patch) | |
tree | 853729acb592834215cdd25a4bc0bf4113e38c80 /src/imports/controls/material/qquickmaterialprogressring.cpp | |
parent | 3553f1dc9fb0f43564bddfe453a1d7843c43cffd (diff) |
Material: fix multiple BusyIndicator instances
Cannot use local static variables to store the values of the last
round, because the values must be stored per instance, not shared
between all busy indicators.
Task-number: QTBUG-54472
Change-Id: Ibb088b077ff8e23b1376e04a0329f001211574f7
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/imports/controls/material/qquickmaterialprogressring.cpp')
-rw-r--r-- | src/imports/controls/material/qquickmaterialprogressring.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/imports/controls/material/qquickmaterialprogressring.cpp b/src/imports/controls/material/qquickmaterialprogressring.cpp index cbed6886..8407c7c2 100644 --- a/src/imports/controls/material/qquickmaterialprogressring.cpp +++ b/src/imports/controls/material/qquickmaterialprogressring.cpp @@ -74,6 +74,8 @@ public: void afterNodeSync() override; private: + int m_lastStartAngle; + int m_lastEndAngle; qreal m_devicePixelRatio; QSGNode *m_containerNode; QQuickWindow *m_window; @@ -167,6 +169,8 @@ QQuickAnimatorJob *QQuickMaterialRingAnimator::createJob() const } QQuickMaterialRingAnimatorJob::QQuickMaterialRingAnimatorJob() : + m_lastStartAngle(0), + m_lastEndAngle(0), m_devicePixelRatio(1.0), m_containerNode(nullptr), m_window(nullptr) @@ -215,27 +219,25 @@ void QQuickMaterialRingAnimatorJob::updateCurrentTime(int time) const int iteration = time / spanAnimationDuration; int startAngle = 0; int endAngle = 0; - static int lastStartAngle = 0; - static int lastEndAngle = 0; if (iteration % 2 == 0) { - if (lastStartAngle > 360 * oneDegree) { - lastStartAngle -= 360 * oneDegree; + if (m_lastStartAngle > 360 * oneDegree) { + m_lastStartAngle -= 360 * oneDegree; } // The start angle is only affected by the rotation animation for the "grow" phase. - startAngle = lastStartAngle; + startAngle = m_lastStartAngle; QEasingCurve angleCurve(QEasingCurve::OutQuad); const qreal percentage = angleCurve.valueForProgress(spanPercentageComplete); - endAngle = lastStartAngle + minSweepSpan + percentage * (maxSweepSpan - minSweepSpan); - lastEndAngle = endAngle; + endAngle = m_lastStartAngle + minSweepSpan + percentage * (maxSweepSpan - minSweepSpan); + m_lastEndAngle = endAngle; } else { // Both the start angle *and* the span are affected by the "shrink" phase. QEasingCurve angleCurve(QEasingCurve::InQuad); const qreal percentage = angleCurve.valueForProgress(spanPercentageComplete); - startAngle = lastEndAngle - maxSweepSpan + percentage * (maxSweepSpan - minSweepSpan); - endAngle = lastEndAngle; - lastStartAngle = startAngle; + startAngle = m_lastEndAngle - maxSweepSpan + percentage * (maxSweepSpan - minSweepSpan); + endAngle = m_lastEndAngle; + m_lastStartAngle = startAngle; } const int halfPen = pen.width() / 2; |