From 365e9f68eda02ac81a1058fd54567e228c5fc0a7 Mon Sep 17 00:00:00 2001 From: Kimmo Ollila Date: Tue, 5 Jan 2016 11:51:27 +0200 Subject: Made close button swipeable to avoid overlapping with demos. Task-Id: QTRD-3797 Change-Id: Idc2de74cc56d4e78f05c380690df93951bd4109f Reviewed-by: Teemu Holappa --- qml/Main.qml | 20 ++++++++++++++++++-- qml/images/close-button.png | Bin 5091 -> 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 Binary files a/qml/images/close-button.png and b/qml/images/close-button.png differ -- cgit v1.2.3