Skip to content

Commit

Permalink
Set focus on opened code reader/drawing popup so ESC can close that i…
Browse files Browse the repository at this point in the history
…nstead of the app
  • Loading branch information
nirvn committed Apr 14, 2024
1 parent bdea9aa commit d1108e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/qml/QFieldSketcher.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,18 @@ Popup {
closePolicy: Popup.CloseOnEscape
dim: true

onOpened: {
contentItem.forceActiveFocus()
}

Settings {
id: settings
property color strokeColor: "#000000"
}

Page {
Pane {
width: parent.width
height: parent.height
padding: 0

DrawingCanvas {
id: drawingCanvas
Expand Down
4 changes: 4 additions & 0 deletions src/qml/imports/QFieldControls/CodeReader.qml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ Popup {
}
}

onOpened: {
contentItem.forceActiveFocus()
}

onAboutToHide: {
if (cameraLoader.active) {
cameraLoader.item.camera.torchMode = Camera.TorchOff
Expand Down

0 comments on commit d1108e3

Please sign in to comment.