diff options
Diffstat (limited to 'examples/declarative/dial')
-rw-r--r-- | examples/declarative/dial/content/Dial.qml | 37 | ||||
-rw-r--r-- | examples/declarative/dial/content/background.png | bin | 0 -> 35876 bytes | |||
-rw-r--r-- | examples/declarative/dial/content/needle.png | bin | 0 -> 342 bytes | |||
-rw-r--r-- | examples/declarative/dial/content/needle_shadow.png | bin | 0 -> 632 bytes | |||
-rw-r--r-- | examples/declarative/dial/content/overlay.png | bin | 0 -> 3564 bytes | |||
-rw-r--r-- | examples/declarative/dial/dial.qml | 35 |
6 files changed, 72 insertions, 0 deletions
diff --git a/examples/declarative/dial/content/Dial.qml b/examples/declarative/dial/content/Dial.qml new file mode 100644 index 0000000..6fd0f39 --- /dev/null +++ b/examples/declarative/dial/content/Dial.qml @@ -0,0 +1,37 @@ +import Qt 4.6 + +Item { + id: root + property real value : 0 + + width: 210; height: 210 + + Image { source: "background.png" } + + Image { + x: 93 + y: 35 + source: "needle_shadow.png" + transform: Rotation { + origin.x: 11; origin.y: 67 + angle: needleRotation.angle + } + } + Image { + id: needle + x: 95; y: 33 + smooth: true + source: "needle.png" + transform: Rotation { + id: needleRotation + origin.x: 7; origin.y: 65 + angle: -130 + angle: SpringFollow { + spring: 1.4 + damping: .15 + source: Math.min(Math.max(-130, root.value*2.6 - 130), 133) + } + } + } + Image { x: 21; y: 18; source: "overlay.png" } +} diff --git a/examples/declarative/dial/content/background.png b/examples/declarative/dial/content/background.png Binary files differnew file mode 100644 index 0000000..75d555d --- /dev/null +++ b/examples/declarative/dial/content/background.png diff --git a/examples/declarative/dial/content/needle.png b/examples/declarative/dial/content/needle.png Binary files differnew file mode 100644 index 0000000..2d19f75 --- /dev/null +++ b/examples/declarative/dial/content/needle.png diff --git a/examples/declarative/dial/content/needle_shadow.png b/examples/declarative/dial/content/needle_shadow.png Binary files differnew file mode 100644 index 0000000..8d8a928 --- /dev/null +++ b/examples/declarative/dial/content/needle_shadow.png diff --git a/examples/declarative/dial/content/overlay.png b/examples/declarative/dial/content/overlay.png Binary files differnew file mode 100644 index 0000000..3860a7b --- /dev/null +++ b/examples/declarative/dial/content/overlay.png diff --git a/examples/declarative/dial/dial.qml b/examples/declarative/dial/dial.qml new file mode 100644 index 0000000..c7b7659 --- /dev/null +++ b/examples/declarative/dial/dial.qml @@ -0,0 +1,35 @@ +import Qt 4.6 +import "content" + +Rectangle { + color: "#545454" + width: 300; height: 300 + + // Dial with a slider to adjust it + Dial { id: dial; anchors.centerIn: parent; value: slider.x *100 / (container.width - 34) } + + Rectangle { + id: container + anchors.bottom: parent.bottom; anchors.bottomMargin: 10 + anchors.left: parent.left; anchors.leftMargin: 20 + anchors.right: parent.right; anchors.rightMargin: 20; height: 16 + gradient: Gradient { + GradientStop { position: 0.0; color: "gray" } + GradientStop { position: 1.0; color: "white" } + } + radius: 8; opacity: 0.7; smooth: true + Rectangle { + id: slider + x: 1; y: 1; width: 30; height: 14 + radius: 6; smooth: true + gradient: Gradient { + GradientStop { position: 0.0; color: "#424242" } + GradientStop { position: 1.0; color: "black" } + } + MouseRegion { + anchors.fill: parent + drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: container.width - 32 + } + } + } +} |