Skip to content

Commit

Permalink
components: handle enter and return
Browse files Browse the repository at this point in the history
  • Loading branch information
selsta committed Dec 10, 2019
1 parent f03ea04 commit 38d412a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions components/InlineButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ Item {
source: rect
}

Keys.enabled: inlineButton.visible
Keys.onSpacePressed: doClick()
Keys.onEnterPressed: Keys.onReturnPressed(event)
Keys.onReturnPressed: doClick()
}
2 changes: 2 additions & 0 deletions components/InputDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ Item {
color: MoneroComponents.Style.blackTheme ? "black" : "#A9FFFFFF"
}

Keys.enabled: root.visible
Keys.onEnterPressed: Keys.onReturnPressed(event)
Keys.onReturnPressed: {
root.close()
root.accepted()
Expand Down
3 changes: 3 additions & 0 deletions components/PasswordDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ Item {
}

Keys.enabled: root.visible
Keys.onEnterPressed: Keys.onReturnPressed(event)
Keys.onReturnPressed: {
root.close()
if (passwordDialogMode) {
Expand Down Expand Up @@ -352,6 +353,8 @@ Item {
}
}

Keys.enabled: root.visible
Keys.onEnterPressed: Keys.onReturnPressed(event)
Keys.onReturnPressed: {
if (passwordInput1.text === passwordInput2.text) {
root.close()
Expand Down
2 changes: 2 additions & 0 deletions components/StandardButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ Item {
cursorShape: Qt.PointingHandCursor
}

Keys.enabled: button.visible
Keys.onSpacePressed: doClick()
Keys.onEnterPressed: Keys.onReturnPressed(event)
Keys.onReturnPressed: doClick()
}

0 comments on commit 38d412a

Please sign in to comment.