summaryrefslogtreecommitdiff
path: root/examples/declarative/ui-components/spinner
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2010-05-14 11:32:57 +1000
committerBea Lam <bea.lam@nokia.com>2010-05-17 09:42:12 +1000
commit82d0b03c4f81c2832975d548917c03dbaddeee72 (patch)
treecb2d7ae0c7c8c5870f4c9439453c938a9423afad /examples/declarative/ui-components/spinner
parent0aca20bf669ef7e7702ee96d0d0676392cfd1b72 (diff)
downloadqt4-tools-82d0b03c4f81c2832975d548917c03dbaddeee72.tar.gz
Restructure the examples. They are now organized into various
subdirectories to make it easier to locate examples for certain features (e.g. animation) and to distinguish between different types of examples (e.g. very basic examples vs complex demo-like examples).
Diffstat (limited to 'examples/declarative/ui-components/spinner')
-rw-r--r--examples/declarative/ui-components/spinner/content/Spinner.qml25
-rw-r--r--examples/declarative/ui-components/spinner/content/spinner-bg.pngbin0 -> 345 bytes
-rw-r--r--examples/declarative/ui-components/spinner/content/spinner-select.pngbin0 -> 320 bytes
-rw-r--r--examples/declarative/ui-components/spinner/main.qml18
-rw-r--r--examples/declarative/ui-components/spinner/spinner.qmlproject16
5 files changed, 59 insertions, 0 deletions
diff --git a/examples/declarative/ui-components/spinner/content/Spinner.qml b/examples/declarative/ui-components/spinner/content/Spinner.qml
new file mode 100644
index 0000000000..8145a28dcd
--- /dev/null
+++ b/examples/declarative/ui-components/spinner/content/Spinner.qml
@@ -0,0 +1,25 @@
+import Qt 4.7
+
+Image {
+ property alias model: view.model
+ property alias delegate: view.delegate
+ property alias currentIndex: view.currentIndex
+ property real itemHeight: 30
+ source: "spinner-bg.png"
+ clip: true
+ PathView {
+ id: view
+ anchors.fill: parent
+ pathItemCount: height/itemHeight
+ preferredHighlightBegin: 0.5
+ preferredHighlightEnd: 0.5
+ highlight: Image { source: "spinner-select.png"; width: view.width; height: itemHeight+4 }
+ dragMargin: view.width/2
+ path: Path {
+ startX: view.width/2; startY: -itemHeight/2
+ PathLine { x: view.width/2; y: view.pathItemCount*itemHeight + itemHeight }
+ }
+ }
+ Keys.onDownPressed: view.incrementCurrentIndex()
+ Keys.onUpPressed: view.decrementCurrentIndex()
+}
diff --git a/examples/declarative/ui-components/spinner/content/spinner-bg.png b/examples/declarative/ui-components/spinner/content/spinner-bg.png
new file mode 100644
index 0000000000..b3556f1f9f
--- /dev/null
+++ b/examples/declarative/ui-components/spinner/content/spinner-bg.png
Binary files differ
diff --git a/examples/declarative/ui-components/spinner/content/spinner-select.png b/examples/declarative/ui-components/spinner/content/spinner-select.png
new file mode 100644
index 0000000000..95a17a1fe2
--- /dev/null
+++ b/examples/declarative/ui-components/spinner/content/spinner-select.png
Binary files differ
diff --git a/examples/declarative/ui-components/spinner/main.qml b/examples/declarative/ui-components/spinner/main.qml
new file mode 100644
index 0000000000..6be567a0a5
--- /dev/null
+++ b/examples/declarative/ui-components/spinner/main.qml
@@ -0,0 +1,18 @@
+import Qt 4.7
+import "content"
+
+Rectangle {
+ width: 240; height: 320
+ Column {
+ y: 20; x: 20; spacing: 20
+ Spinner {
+ id: spinner
+ width: 200; height: 240
+ focus: true
+ model: 20
+ itemHeight: 30
+ delegate: Text { font.pixelSize: 25; text: index; height: 30 }
+ }
+ Text { text: "Current item index: " + spinner.currentIndex }
+ }
+}
diff --git a/examples/declarative/ui-components/spinner/spinner.qmlproject b/examples/declarative/ui-components/spinner/spinner.qmlproject
new file mode 100644
index 0000000000..d4909f8685
--- /dev/null
+++ b/examples/declarative/ui-components/spinner/spinner.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.0
+
+Project {
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+ /* List of plugin directories passed to QML runtime */
+ // importPaths: [ " ../exampleplugin " ]
+}