diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-01-26 14:24:04 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-01-28 09:29:30 +0000 |
commit | 147c215ec9174c394bcaa2c33760df735f4d1ebf (patch) | |
tree | 4234dc2fa594f1bb02384d6c2b1fddcb83e1d121 /src/imports/controls/material/ProgressBar.qml | |
parent | 39af88a8da473afe039201164a4c2a7980f7c2f9 (diff) |
Material ProgressBar: implement indeterminate animator
The indicator is now a single QQuickItem, and runs in the render
thread, so keeps animating even if the app is busy.
Before:
RESULT : tst_CreationTime::material():"ProgressBar":
0.30 msecs per iteration (total: 79, iterations: 256)
After:
RESULT : tst_CreationTime::material():"ProgressBar":
0.18 msecs per iteration (total: 93, iterations: 512)
Change-Id: I3ec0982da9a02751725692c72da10a01d2afbfdc
Task-number: QTBUG-50161
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/imports/controls/material/ProgressBar.qml')
-rw-r--r-- | src/imports/controls/material/ProgressBar.qml | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/src/imports/controls/material/ProgressBar.qml b/src/imports/controls/material/ProgressBar.qml index 59c03204..52df1660 100644 --- a/src/imports/controls/material/ProgressBar.qml +++ b/src/imports/controls/material/ProgressBar.qml @@ -37,6 +37,7 @@ import QtQuick 2.6 import Qt.labs.templates 1.0 as T import Qt.labs.controls.material 1.0 +import Qt.labs.controls.material.impl 1.0 T.ProgressBar { id: control @@ -47,40 +48,21 @@ T.ProgressBar { indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding //! [indicator] - indicator: Item { + indicator: ProgressStrip { + id: strip x: control.leftPadding - y: control.topPadding + y: control.topPadding + (control.availableHeight - height) / 2 width: control.availableWidth - height: control.availableHeight + height: 4 scale: control.mirrored ? -1 : 1 + indeterminate: control.indeterminate + color: control.Material.accentColor + progress: control.position - Repeater { - model: indeterminate ? 2 : 1 - - Rectangle { - property real offset: indeterminate ? 0 : control.position - - x: (indeterminate ? offset * parent.width : 0) - y: (parent.height - height) / 2 - width: offset * (parent.width - x) - height: 4 - - color: control.Material.accentColor - - SequentialAnimation on offset { - loops: Animation.Infinite - running: indeterminate && visible - PauseAnimation { duration: index ? 520 : 0 } - NumberAnimation { - easing.type: Easing.OutCubic - duration: 1240 - from: 0 - to: 1 - } - PauseAnimation { duration: index ? 0 : 520 } - } - } + StripAnimator { + target: strip + running: control.visible && control.indeterminate } } //! [indicator] |