diff options
Diffstat (limited to 'examples/declarative/ui-components/spinner')
-rw-r--r-- | examples/declarative/ui-components/spinner/content/Spinner.qml | 25 | ||||
-rw-r--r-- | examples/declarative/ui-components/spinner/content/spinner-bg.png | bin | 0 -> 345 bytes | |||
-rw-r--r-- | examples/declarative/ui-components/spinner/content/spinner-select.png | bin | 0 -> 320 bytes | |||
-rw-r--r-- | examples/declarative/ui-components/spinner/main.qml | 18 | ||||
-rw-r--r-- | examples/declarative/ui-components/spinner/spinner.qmlproject | 16 |
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 Binary files differnew file mode 100644 index 0000000000..b3556f1f9f --- /dev/null +++ b/examples/declarative/ui-components/spinner/content/spinner-bg.png diff --git a/examples/declarative/ui-components/spinner/content/spinner-select.png b/examples/declarative/ui-components/spinner/content/spinner-select.png Binary files differnew file mode 100644 index 0000000000..95a17a1fe2 --- /dev/null +++ b/examples/declarative/ui-components/spinner/content/spinner-select.png 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 " ] +} |