on xenial help sign in
Make placeholder text the right color
commit01653b52c394f87b27ad49e7e5fe29035eef7ff8 authorMichael Terry <michael.terry@canonical.com> dateTue 31 May 2016, 09:37 (10 years ago) parentc0f0a57
1 file changed+24−2
qml/Greeter/GreeterPrompt.qml+24−2
qml/Greeter/GreeterPrompt.qml+24−2
@@ -82,9 +82,10 @@ FocusScope {
8282
8383 inputMethodHints: root.isAlphanumeric ? Qt.ImhNone : Qt.ImhDigitsOnly
8484 echoMode: root.isSecret ? TextInput.Password : TextInput.Normal
85− placeholderText: " " + root.text // add some spacing here
8685 hasClearButton: false
8786
87+ readonly property real frameSpacing: units.gu(0.5)
88+
8889 style: Item {
8990 property color color: d.textColor
9091 property color selectedTextColor: d.selectedColor
@@ -92,12 +93,13 @@ FocusScope {
9293 property color borderColor: "transparent"
9394 property color backgroundColor: "transparent"
9495 property color errorColor: d.errorColor
95− property real frameSpacing: units.gu(0.5)
96+ property real frameSpacing: passwordInput.frameSpacing
9697 anchors.fill: parent
9798 }
9899
99100 secondaryItem: [
100101 Icon {
102+ id: capsIcon
101103 name: "keyboard-caps-enabled"
102104 height: units.gu(3)
103105 width: units.gu(3)
@@ -124,5 +126,25 @@ FocusScope {
124126 }
125127 }
126128 }
129+
130+ // We use our own custom placeholder label instead of the standard
131+ // TextField one because the standard one hardcodes baseText as the
132+ // palette color, whereas we want raisedSecondaryText.
133+ Label {
134+ id: hint
135+ anchors {
136+ left: parent.left
137+ right: parent.right
138+ verticalCenter: parent.verticalCenter
139+ leftMargin: units.gu(1.5)
140+ rightMargin: anchors.leftMargin +
141+ (capsIcon.visible ? capsIcon.width + passwordInput.frameSpacing
142+ : 0)
143+ }
144+ text: root.text
145+ visible: passwordInput.text == "" && !passwordInput.inputMethodComposing
146+ color: theme.palette.normal.raisedSecondaryText
147+ elide: Text.ElideRight
148+ }
127149 }
128150}