diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-10-16 08:06:09 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-10-16 08:06:09 (GMT) |
commit | 7c87a5a623bcb17b207c1c26a7499e142304f319 (patch) | |
tree | 0a9c39d2d1c12b9b0eab14dadf396dcc617c408f /examples/declarative | |
parent | 95b158432f15f412b1e14293305c3cf449f60548 (diff) | |
parent | 0fef8fe9390ddf3b0dff0a54f50a2f61c3449950 (diff) | |
download | Qt-7c87a5a623bcb17b207c1c26a7499e142304f319.zip Qt-7c87a5a623bcb17b207c1c26a7499e142304f319.tar.gz Qt-7c87a5a623bcb17b207c1c26a7499e142304f319.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'examples/declarative')
-rw-r--r-- | examples/declarative/progressbar/ProgressBar.qml | 36 | ||||
-rw-r--r-- | examples/declarative/progressbar/images/lineedit-bg.png | bin | 0 -> 426 bytes | |||
-rw-r--r-- | examples/declarative/progressbar/main.qml | 23 | ||||
-rw-r--r-- | examples/declarative/searchbox/SearchBox.qml | 47 | ||||
-rw-r--r-- | examples/declarative/searchbox/images/edit-clear-locationbar-rtl.png | bin | 0 -> 859 bytes | |||
-rw-r--r-- | examples/declarative/searchbox/images/lineedit-bg-focus.png | bin | 0 -> 526 bytes | |||
-rw-r--r-- | examples/declarative/searchbox/images/lineedit-bg.png | bin | 0 -> 426 bytes | |||
-rw-r--r-- | examples/declarative/searchbox/main.qml | 13 |
8 files changed, 119 insertions, 0 deletions
diff --git a/examples/declarative/progressbar/ProgressBar.qml b/examples/declarative/progressbar/ProgressBar.qml new file mode 100644 index 0000000..48346ac --- /dev/null +++ b/examples/declarative/progressbar/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: "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: 100 } + 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/images/lineedit-bg.png b/examples/declarative/progressbar/images/lineedit-bg.png Binary files differnew file mode 100644 index 0000000..9044226 --- /dev/null +++ b/examples/declarative/progressbar/images/lineedit-bg.png diff --git a/examples/declarative/progressbar/main.qml b/examples/declarative/progressbar/main.qml new file mode 100644 index 0000000..32353fc --- /dev/null +++ b/examples/declarative/progressbar/main.qml @@ -0,0 +1,23 @@ +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/searchbox/SearchBox.qml b/examples/declarative/searchbox/SearchBox.qml new file mode 100644 index 0000000..90d4367 --- /dev/null +++ b/examples/declarative/searchbox/SearchBox.qml @@ -0,0 +1,47 @@ +import Qt 4.6 + +FocusScope { + id: focusScope + width: 250; height: 28 + + BorderImage { + source: "images/lineedit-bg.png" + width: parent.width; height: parent.height + border.left: 4; border.top: 4; border.right: 4; border.bottom: 4 + } + + BorderImage { + source: "images/lineedit-bg-focus.png" + width: parent.width; height: parent.height + border.left: 4; border.top: 4; border.right: 4; border.bottom: 4 + visible: parent.wantsFocus ? true : false + } + + Text { + anchors.fill: parent; anchors.leftMargin: 8 + verticalAlignment: Text.AlignVCenter + text: "Type something..."; color: "gray"; font.italic: true + opacity: textInput.text == "" ? 1 : 0 + //opacity: Behavior { NumberAnimation { duration: 200 } } + } + + MouseRegion { anchors.fill: parent; onClicked: focusScope.focus = true } + + + TextInput { + id: textInput + anchors.left: parent.left; anchors.leftMargin: 8 + //anchors.right: clear.left + anchors.verticalCenter: parent.verticalCenter + focus: if(1) true + } + Image { + id: clear + anchors.right: parent.right; anchors.rightMargin: 8 + anchors.verticalCenter: parent.verticalCenter + source: "images/edit-clear-locationbar-rtl.png" + opacity: textInput.text == "" ? 0 : 1 + //opacity: Behavior { NumberAnimation { duration: 200 } } + MouseRegion { anchors.fill: parent; onClicked: { textInput.text = ''; focusScope.focus = true } } + } +} diff --git a/examples/declarative/searchbox/images/edit-clear-locationbar-rtl.png b/examples/declarative/searchbox/images/edit-clear-locationbar-rtl.png Binary files differnew file mode 100644 index 0000000..45ae477 --- /dev/null +++ b/examples/declarative/searchbox/images/edit-clear-locationbar-rtl.png diff --git a/examples/declarative/searchbox/images/lineedit-bg-focus.png b/examples/declarative/searchbox/images/lineedit-bg-focus.png Binary files differnew file mode 100644 index 0000000..bbfac38 --- /dev/null +++ b/examples/declarative/searchbox/images/lineedit-bg-focus.png diff --git a/examples/declarative/searchbox/images/lineedit-bg.png b/examples/declarative/searchbox/images/lineedit-bg.png Binary files differnew file mode 100644 index 0000000..9044226 --- /dev/null +++ b/examples/declarative/searchbox/images/lineedit-bg.png diff --git a/examples/declarative/searchbox/main.qml b/examples/declarative/searchbox/main.qml new file mode 100644 index 0000000..39c3720 --- /dev/null +++ b/examples/declarative/searchbox/main.qml @@ -0,0 +1,13 @@ +import Qt 4.6 + +Rectangle { + width: 500; height: 250; color: "#edecec" + + Column { + anchors.horizontalCenter: parent.horizontalCenter; anchors.verticalCenter: parent.verticalCenter; spacing: 10 + + SearchBox { id: search1; KeyNavigation.down: search2; focus: true } + SearchBox { id: search2; KeyNavigation.up: search1; KeyNavigation.down: search3 } + SearchBox { id: search3; KeyNavigation.up: search2 } + } +} |