diff --git a/app/qml/components/MMDrawer.qml b/app/qml/components/MMDrawer.qml index 6f5e75e95..4badaa59f 100644 --- a/app/qml/components/MMDrawer.qml +++ b/app/qml/components/MMDrawer.qml @@ -48,13 +48,6 @@ Drawer { height: parent.height / 2 y: parent.height / 2 } - - Keys.onReleased: function( event ) { - if ( event.key === Qt.Key_Back || event.key === Qt.Key_Escape ) { - root.close() - event.accepted = true - } - } } contentItem: Column { @@ -62,6 +55,14 @@ Drawer { anchors.fill: parent spacing: 0 + focus : true + + Keys.onReleased: function( event ) { + if ( event.key === Qt.Key_Back || event.key === Qt.Key_Escape ) { + root.close() + event.accepted = true + } + } MMListSpacer { id: topSpacer diff --git a/app/qml/form/MMFormPage.qml b/app/qml/form/MMFormPage.qml index c07bce48d..f12a9647f 100644 --- a/app/qml/form/MMFormPage.qml +++ b/app/qml/form/MMFormPage.qml @@ -71,6 +71,18 @@ Page { } ] + Keys.onReleased: function( event ) { + if ( event.key === Qt.Key_Back || event.key === Qt.Key_Escape ) { + if ( root.controller.hasAnyChanges ) { + saveChangesDialog.open() + } + else { + root.rollbackAndClose() + } + event.accepted = true; + } + } + property bool layerIsReadOnly: true property bool layerIsSpatial: true @@ -303,8 +315,6 @@ Page { active: fieldWidget !== 'Hidden' - Keys.forwardTo: backHandler - source: { if ( model.EditorWidget !== undefined ) { return __inputUtils.getFormEditorType( model.EditorWidget, model.EditorWidgetConfig, model.Field, model.Relation, model.Name ) @@ -404,28 +414,6 @@ Page { id: editingFailedDialog } - Item { - id: backHandler - - focus: true - Keys.onReleased: function( event ) { - if ( event.key === Qt.Key_Back || event.key === Qt.Key_Escape ) { - if ( root.controller.hasAnyChanges ) { - saveChangesDialog.open() - } - else { - root.rollbackAndClose() - } - event.accepted = true; - } - } - - onVisibleChanged: function( visible ) { - if ( visible ) - backHandler.forceActiveFocus() - } - } - Connections { target: Qt.inputMethod