Add character count :)

This commit is contained in:
Zach Fox 2018-01-10 16:23:29 -08:00
parent 260aee42a8
commit b3e3af4ee7

View file

@ -833,6 +833,7 @@ Item {
activeFocusOnTab: true;
// Workaround for no max length on TextAreas
onTextChanged: {
optionalMessageCharacterCount.text = optionalMessage.text.length + "/" + optionalMessage.maximumLength;
if (text.length > maximumLength) {
var cursor = cursorPosition;
text = previousText;
@ -845,6 +846,20 @@ Item {
previousText = text;
}
}
RalewaySemiBold {
id: optionalMessageCharacterCount;
// Anchors
anchors.top: optionalMessage.bottom;
anchors.topMargin: 2;
anchors.right: optionalMessage.right;
height: paintedHeight;
// Text size
size: 16;
// Style
color: hifi.colors.baseGray;
verticalAlignment: Text.AlignTop;
horizontalAlignment: Text.AlignRight;
}
}
Item {