summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKimmo Ollila <kimmo.ollila@theqtcompany.com>2016-01-05 11:51:27 +0200
committerKimmo Ollila <kimmo.ollila@theqtcompany.com>2016-01-05 10:14:57 +0000
commit365e9f68eda02ac81a1058fd54567e228c5fc0a7 (patch)
treec2b841735c3efac27580a18185f2f7eddb1421ee
parent5f10cf531774eb0bc9c6e3cc077b3c6c9a2ea1c5 (diff)
Made close button swipeable to avoid overlapping with demos.
Task-Id: QTRD-3797 Change-Id: Idc2de74cc56d4e78f05c380690df93951bd4109f Reviewed-by: Teemu Holappa <teemu.holappa@theqtcompany.com>
-rw-r--r--qml/Main.qml20
-rw-r--r--qml/images/close-button.pngbin5091 -> 5241 bytes
2 files changed, 18 insertions, 2 deletions
diff --git a/qml/Main.qml b/qml/Main.qml
index 5b1db16..7d61562 100644
--- a/qml/Main.qml
+++ b/qml/Main.qml
@@ -215,15 +215,31 @@ Window {
id: applicationCloseButton
source: "images/close-button.png"
anchors.horizontalCenter: parent.horizontalCenter
- anchors.horizontalCenterOffset: parent.width / 4
enabled: engine.state == "app-running"
+ y: -height * .6
+ z: 1
+
+ Behavior on y { NumberAnimation { duration: 100 } }
+
MouseArea {
anchors.fill: parent
+ drag.target: applicationCloseButton
+ drag.axis: Drag.YAxis
+ drag.minimumX: -applicationCloseButton.height * .6
+ drag.maximumY: 0
+
onClicked: {
+ if (applicationCloseButton.y < -applicationCloseButton.height / 2)
+ return;
+
engine.state = "app-closing"
+ applicationCloseButton.y = -applicationCloseButton.height * .6
}
+
+ onReleased: applicationCloseButton.y = applicationCloseButton.y > -applicationCloseButton.height / 2 ?
+ 0 :
+ -applicationCloseButton.height * .6
}
- z: 1
}
}
diff --git a/qml/images/close-button.png b/qml/images/close-button.png
index edcbe15..4d0f883 100644
--- a/qml/images/close-button.png
+++ b/qml/images/close-button.png
Binary files differ