summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZeno Albisser <zeno.albisser@nokia.com>2010-11-23 13:09:33 +0100
committerZeno Albisser <zeno.albisser@nokia.com>2010-11-23 13:18:03 +0100
commitb967e5107cb402f6fd1d42e3cf8014669055eb31 (patch)
treede55d29581e9ffb5d58684d52068bb8abd421cef
parent0b91cfd9f4dfae9aea52ab9ad32891c692385da2 (diff)
added flickabletest exampleHEADmaster
-rw-r--r--flickabletest/flickabletest.pro4
-rw-r--r--flickabletest/image2.pngbin0 -> 14396 bytes
-rw-r--r--flickabletest/main.qml83
3 files changed, 87 insertions, 0 deletions
diff --git a/flickabletest/flickabletest.pro b/flickabletest/flickabletest.pro
new file mode 100644
index 0000000..88c0d60
--- /dev/null
+++ b/flickabletest/flickabletest.pro
@@ -0,0 +1,4 @@
+
+TEMPLATE = subdirs
+
+# Directories
diff --git a/flickabletest/image2.png b/flickabletest/image2.png
new file mode 100644
index 0000000..c70d505
--- /dev/null
+++ b/flickabletest/image2.png
Binary files differ
diff --git a/flickabletest/main.qml b/flickabletest/main.qml
new file mode 100644
index 0000000..9a68f5c
--- /dev/null
+++ b/flickabletest/main.qml
@@ -0,0 +1,83 @@
+import Qt 4.7
+import Qt.labs.gestures 2.0
+
+Rectangle {
+ id: topWin
+ width: 200
+ height: 200
+ color: "#ff0000"
+
+ function calculateBoundingBox(angle) {
+ angle = angle*Math.PI/180
+ var sin = Math.abs(Math.sin(angle))
+ var cos = Math.abs(Math.cos(angle))
+ flicktarget.height = (sin*pinchable.width) + (cos*pinchable.height)
+ flicktarget.width = (sin*pinchable.height) + (cos*pinchable.width)
+ }
+
+
+ Flickable {
+ id: flickable
+ anchors.fill: parent
+ contentWidth: flicktarget.width; contentHeight: flicktarget.height
+
+ GestureArea {
+ anchors.fill: parent
+
+ Pinch {
+ onUpdated: {
+ if (gesture.changeFlags & PinchGesture.RotationAngleChanged)
+ pinchable.rotation += gesture.rotationAngle - gesture.lastRotationAngle
+ if (gesture.changeFlags & PinchGesture.ScaleFactorChanged) {
+ pinchable.width *= gesture.scaleFactor
+ pinchable.height *= gesture.scaleFactor
+ }
+ calculateBoundingBox(pinchable.rotation)
+ }
+ }
+ }
+
+ Rectangle {
+ id: flicktarget
+ width: topWin.width
+ height: topWin.height
+
+ Image {
+ id: pinchable
+ source: "image2.png"
+ anchors.centerIn: parent
+ width: topWin.width
+ height: topWin.height
+
+ clip: true
+ }
+
+ }
+
+
+ }
+
+ Rectangle {
+ x: 826
+ y: 0
+ width: 40
+ height: 40
+ color: "grey"
+ Text {
+ anchors.centerIn: parent
+ text: "exit"
+ font.bold: true
+ font.pointSize: 12
+ }
+ GestureArea {
+ anchors.fill: parent
+ Tap {
+ onFinished: {
+ Qt.quit()
+ }
+ }
+ }
+ }
+}
+
+