Prevent the login dialog from spawning the address bar on enter keys

This commit is contained in:
Brad Davis 2015-04-27 16:00:23 -07:00
parent fd28baac8c
commit 1beaf18d1b

View file

@ -60,9 +60,6 @@ Dialog {
anchors.margins: 8
KeyNavigation.tab: password
KeyNavigation.backtab: password
onAccepted: {
password.forceActiveFocus()
}
}
}
@ -78,13 +75,6 @@ Dialog {
anchors.margins: 8
KeyNavigation.tab: username
KeyNavigation.backtab: username
onAccepted: {
if (username.text == "") {
username.forceActiveFocus()
} else {
loginDialog.login(username.text, password.text)
}
}
onFocusChanged: {
if (password.focus) {
password.selectAll()
@ -187,4 +177,22 @@ Dialog {
}
}
}
Keys.onPressed: {
switch(event.key) {
case Qt.Key_Enter:
case Qt.Key_Return:
if (username.activeFocus) {
event.accepted = true
password.forceActiveFocus()
} else if (password.activeFocus) {
event.accepted = true
if (username.text == "") {
username.forceActiveFocus()
} else {
loginDialog.login(username.text, password.text)
}
}
break;
}
}
}