From 5077089518588c48ef21a323dff8b13af6b31925 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Thu, 19 Sep 2019 11:15:53 -0700 Subject: [PATCH] BUGZ-1529: Iteration on JumpTo Field visuals/interaction states. NOTE - need to fix placeholder text swap --- .../simplifiedUI/simplifiedControls/TextField.qml | 15 +++++++++++++++ .../hifi/simplifiedUI/topBar/SimplifiedTopBar.qml | 9 +++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/interface/resources/qml/hifi/simplifiedUI/simplifiedControls/TextField.qml b/interface/resources/qml/hifi/simplifiedUI/simplifiedControls/TextField.qml index 1dd3a80a52..44f34c3356 100644 --- a/interface/resources/qml/hifi/simplifiedUI/simplifiedControls/TextField.qml +++ b/interface/resources/qml/hifi/simplifiedUI/simplifiedControls/TextField.qml @@ -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); diff --git a/interface/resources/qml/hifi/simplifiedUI/topBar/SimplifiedTopBar.qml b/interface/resources/qml/hifi/simplifiedUI/topBar/SimplifiedTopBar.qml index 5e82804cf6..f53a72bc00 100644 --- a/interface/resources/qml/hifi/simplifiedUI/topBar/SimplifiedTopBar.qml +++ b/interface/resources/qml/hifi/simplifiedUI/topBar/SimplifiedTopBar.qml @@ -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(); } } }