Enable address entry by typing without clicking in address bar

This commit is contained in:
David Rowe 2016-10-06 15:18:07 +13:00
parent 808419d988
commit b70eac353b

View file

@ -185,7 +185,7 @@ Window {
color: "gray"; color: "gray";
clip: true; clip: true;
anchors.fill: addressLine; anchors.fill: addressLine;
visible: !addressLine.activeFocus; visible: addressLine.text.length === 0
} }
TextInput { TextInput {
id: addressLine id: addressLine
@ -201,8 +201,10 @@ Window {
bottomMargin: parent.inputAreaStep bottomMargin: parent.inputAreaStep
} }
font.pixelSize: hifi.fonts.pixelSize * root.scale * 0.75 font.pixelSize: hifi.fonts.pixelSize * root.scale * 0.75
onTextChanged: filterChoicesByText() onTextChanged: {
onActiveFocusChanged: updateLocationText(focus) filterChoicesByText();
updateLocationText(text.length > 0);
}
} }
} }
@ -360,9 +362,8 @@ Window {
}); });
} }
function updateLocationText(focus) { function updateLocationText(visible) {
addressLine.text = ""; if (visible) {
if (focus) {
notice.text = "Go to a place, @user, path or network address"; notice.text = "Go to a place, @user, path or network address";
notice.color = "gray"; notice.color = "gray";
} else { } else {
@ -374,9 +375,9 @@ Window {
} }
onVisibleChanged: { onVisibleChanged: {
focus = false;
updateLocationText(false); updateLocationText(false);
if (visible) { if (visible) {
addressLine.forceActiveFocus();
fillDestinations(); fillDestinations();
} }
} }