Skip to content

Commit

Permalink
Fix handling back event in MMFormPage
Browse files Browse the repository at this point in the history
  • Loading branch information
ValentinBuira committed Aug 6, 2024
1 parent 07e7c55 commit 13a94ad
Showing 1 changed file with 12 additions and 24 deletions.
36 changes: 12 additions & 24 deletions app/qml/form/MMFormPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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

Expand Down

1 comment on commit 13a94ad

@inputapp-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS - version 24.8.646611 just submitted!

Please sign in to comment.