From 93ca74ebc54db90416538c78df9f9cc1ea1b006e Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Wed, 25 Nov 2009 11:34:42 +1000 Subject: cleanup progressbar example --- doc/src/declarative/example-slideswitch.qdoc | 2 +- examples/declarative/progressbar/ProgressBar.qml | 36 --------------------- .../progressbar/content/ProgressBar.qml | 36 +++++++++++++++++++++ .../declarative/progressbar/content/background.png | Bin 0 -> 426 bytes .../declarative/progressbar/images/lineedit-bg.png | Bin 426 -> 0 bytes examples/declarative/progressbar/main.qml | 23 ------------- examples/declarative/progressbar/progressbars.qml | 24 ++++++++++++++ 7 files changed, 61 insertions(+), 60 deletions(-) delete mode 100644 examples/declarative/progressbar/ProgressBar.qml create mode 100644 examples/declarative/progressbar/content/ProgressBar.qml create mode 100644 examples/declarative/progressbar/content/background.png delete mode 100644 examples/declarative/progressbar/images/lineedit-bg.png delete mode 100644 examples/declarative/progressbar/main.qml create mode 100644 examples/declarative/progressbar/progressbars.qml diff --git a/doc/src/declarative/example-slideswitch.qdoc b/doc/src/declarative/example-slideswitch.qdoc index c942918..a8376eb 100644 --- a/doc/src/declarative/example-slideswitch.qdoc +++ b/doc/src/declarative/example-slideswitch.qdoc @@ -127,7 +127,7 @@ For more information on scripts see \l{qmlecmascript.html}{ECMAScript Blocks}. \snippet examples/declarative/slideswitch/content/Switch.qml 7 At this point, when the switch toggles between the two states the knob will instantly change its \c x position between 1 and 78. -In order for the the knob to move smoothly we add a transistion that will animate the \c x property with an easing curve for a duration of 200ms. +In order for the the knob to move smoothly we add a transition that will animate the \c x property with an easing curve for a duration of 200ms. For more information on transitions see \l{state-transitions}{QML Transitions}. diff --git a/examples/declarative/progressbar/ProgressBar.qml b/examples/declarative/progressbar/ProgressBar.qml deleted file mode 100644 index 302caa9..0000000 --- a/examples/declarative/progressbar/ProgressBar.qml +++ /dev/null @@ -1,36 +0,0 @@ -import Qt 4.6 - -Item { - id: progressbar - width: 250; height: 23; clip: true - - property int minimum: 0 - property int maximum: 100 - property int value: 0 - property alias color: g1.color - property alias secondColor: g2.color - - BorderImage { - source: "images/lineedit-bg.png" - width: parent.width; height: parent.height - border.left: 4; border.top: 4; border.right: 4; border.bottom: 4 - } - - Rectangle { - property int widthDest: (progressbar.width * (value - minimum)) / (maximum - minimum) - 6 - id: highlight; radius: 2 - anchors.left: parent.left; anchors.top: parent.top; anchors.bottom: parent.bottom - anchors.leftMargin: 3; anchors.topMargin: 3; anchors.bottomMargin: 3 - width: EaseFollow { source: highlight.widthDest; duration: 1000 } - gradient: Gradient { - GradientStop { id: g1; position: 0.0 } - GradientStop { id: g2; position: 1.0 } - } - } - Text { - anchors.right: highlight.right; anchors.rightMargin: 6 - color: "white"; font.bold: true - anchors.verticalCenter: parent.verticalCenter - text: Math.floor((value - minimum) / (maximum - minimum) * 100) + '%' - } -} diff --git a/examples/declarative/progressbar/content/ProgressBar.qml b/examples/declarative/progressbar/content/ProgressBar.qml new file mode 100644 index 0000000..bfc801c --- /dev/null +++ b/examples/declarative/progressbar/content/ProgressBar.qml @@ -0,0 +1,36 @@ +import Qt 4.6 + +Item { + id: progressbar + width: 250; height: 23; clip: true + + property int minimum: 0 + property int maximum: 100 + property int value: 0 + property alias color: g1.color + property alias secondColor: g2.color + + BorderImage { + source: "background.png" + width: parent.width; height: parent.height + border.left: 4; border.top: 4; border.right: 4; border.bottom: 4 + } + + Rectangle { + property int widthDest: ((progressbar.width * (value - minimum)) / (maximum - minimum) - 6) + id: highlight; radius: 1 + anchors.left: parent.left; anchors.top: parent.top; anchors.bottom: parent.bottom + anchors.leftMargin: 3; anchors.topMargin: 3; anchors.bottomMargin: 3 + width: EaseFollow { source: highlight.widthDest; velocity: 1200 } + gradient: Gradient { + GradientStop { id: g1; position: 0.0 } + GradientStop { id: g2; position: 1.0 } + } + } + Text { + anchors.right: highlight.right; anchors.rightMargin: 6 + color: "white"; font.bold: true + anchors.verticalCenter: parent.verticalCenter + text: Math.floor((value - minimum) / (maximum - minimum) * 100) + '%' + } +} diff --git a/examples/declarative/progressbar/content/background.png b/examples/declarative/progressbar/content/background.png new file mode 100644 index 0000000..9044226 Binary files /dev/null and b/examples/declarative/progressbar/content/background.png differ diff --git a/examples/declarative/progressbar/images/lineedit-bg.png b/examples/declarative/progressbar/images/lineedit-bg.png deleted file mode 100644 index 9044226..0000000 Binary files a/examples/declarative/progressbar/images/lineedit-bg.png and /dev/null differ diff --git a/examples/declarative/progressbar/main.qml b/examples/declarative/progressbar/main.qml deleted file mode 100644 index 32353fc..0000000 --- a/examples/declarative/progressbar/main.qml +++ /dev/null @@ -1,23 +0,0 @@ -import Qt 4.6 - -Rectangle { - id: main - width: 800; height: 580; color: "#edecec" - - Flickable { - anchors.fill: parent; viewportHeight: column.height - Column { - id: column; spacing: 4 - Repeater { - model: 50 - ProgressBar { - property int r: Math.floor(Math.random() * 4000 + 1000) - width: main.width - value: NumberAnimation { duration: r; from: 0; to: 100; running: true; repeat: true } - color: ColorAnimation { duration: r; from: "lightsteelblue"; to: "thistle"; running: true; repeat: true } - secondColor: ColorAnimation { duration: r; from: "steelblue"; to: "#CD96CD"; running: true; repeat: true } - } - } - } - } -} diff --git a/examples/declarative/progressbar/progressbars.qml b/examples/declarative/progressbar/progressbars.qml new file mode 100644 index 0000000..6de8ecf --- /dev/null +++ b/examples/declarative/progressbar/progressbars.qml @@ -0,0 +1,24 @@ +import Qt 4.6 +import "content" + +Rectangle { + id: main + width: 600; height: 405; color: "#edecec" + + Flickable { + anchors.fill: parent; viewportHeight: column.height + 20 + Column { + id: column; x: 10; y: 10; spacing: 10 + Repeater { + model: 25 + ProgressBar { + property int r: Math.floor(Math.random() * 5000 + 1000) + width: main.width - 20 + value: NumberAnimation { duration: r; from: 0; to: 100; running: true; repeat: true } + color: ColorAnimation { duration: r; from: "lightsteelblue"; to: "thistle"; running: true; repeat: true } + secondColor: ColorAnimation { duration: r; from: "steelblue"; to: "#CD96CD"; running: true; repeat: true } + } + } + } + } +} -- cgit v0.12