BUGZ-1529: Iteration on JumpTo Field visuals/interaction states. NOTE - need to fix placeholder text swap

This commit is contained in:
Zach Fox 2019-09-19 11:15:53 -07:00
parent a5fdf5bb40
commit 5077089518
2 changed files with 20 additions and 4 deletions

View file

@ -24,6 +24,8 @@ TextField {
property string rightGlyph: ""
property alias bottomBorderVisible: bottomRectangle.visible
property alias backgroundColor: textFieldBackground.color
property string unfocusedPlaceholderText
property bool blankPlaceholderTextOnFocus: true
color: simplifiedUI.colors.text.white
font.family: "Graphik Medium"
@ -47,6 +49,19 @@ TextField {
}
}
onFocusChanged: {
if (!root.blankPlaceholderTextOnFocus) {
return;
}
if (focus) {
root.unfocusedPlaceholderText = root.placeholderText;
root.placeholderText = "";
} else {
root.placeholderText = root.unfocusedPlaceholderText;
}
}
background: Rectangle {
id: textFieldBackground
color: Qt.rgba(0, 0, 0, 0);

View file

@ -372,12 +372,13 @@ Rectangle {
readonly property string shortPlaceholderText: "Jump to..."
readonly property string longPlaceholderText: "Type the name of a location to quickly jump there..."
anchors.centerIn: parent
width: Math.min(parent.width, 600)
height: parent.height - 11
width: Math.min(parent.width, 445)
height: 35
leftPadding: 8
rightPadding: 8
bottomBorderVisible: false
backgroundColor: "#313131"
backgroundColor: "#1D1D1D"
font.pixelSize: 14
placeholderText: width - leftPadding - rightPadding < goToTextFieldMetrics.width ? shortPlaceholderText : longPlaceholderText
clip: true
selectByMouse: true
@ -386,8 +387,8 @@ Rectangle {
if (goToTextField.length > 0) {
AddressManager.handleLookupString(goToTextField.text);
goToTextField.text = "";
parent.forceActiveFocus();
}
parent.forceActiveFocus();
}
}
}