From cc27d274f2b534b5064aca86c6faa259560a33cb Mon Sep 17 00:00:00 2001 From: Niels Weber Date: Thu, 22 May 2014 17:02:59 +0200 Subject: Photoviewer: Allow using the Android back button to go back. Don't show back button on Android, as the system back button can now be used. Task-number: QTBUG-38122 Change-Id: Ia3a677f4626eaf34e23dfcc7997e4b850d8b7020 Reviewed-by: Alessandro Portale --- examples/quick/demos/photoviewer/main.qml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'examples/quick/demos/photoviewer') diff --git a/examples/quick/demos/photoviewer/main.qml b/examples/quick/demos/photoviewer/main.qml index f443b70762..cbafb0112a 100644 --- a/examples/quick/demos/photoviewer/main.qml +++ b/examples/quick/demos/photoviewer/main.qml @@ -49,6 +49,15 @@ ApplicationWindow { visible: true + Rectangle { + focus: true + + Keys.onBackPressed: { + event.accepted = true + backButton.clicked() + } + } + property real downloadProgress: 0 property bool imageLoading: false property bool editMode: false @@ -99,7 +108,14 @@ ApplicationWindow { ListView { anchors.fill: parent; model: albumVisualModel.parts.browser; interactive: false } - Button { id: backButton; label: qsTr("Back"); rotation: 3; x: parent.width - backButton.width - 6; y: -backButton.height - 8 } + Button { + id: backButton + label: qsTr("Back") + rotation: 3 + x: parent.width - backButton.width - 6 + y: -backButton.height - 8 + visible: Qt.platform.os !== "android" + } Rectangle { id: photosShade; color: 'black'; width: parent.width; height: parent.height; opacity: 0; visible: opacity != 0.0 } -- cgit v1.2.3