I have a QML line edit, and am trying to use the input mask to ensure a valid UID is entered. My input mask is set like this:
inputMask: ">\\{NNNNNNNN-NNNN-NNNN-NNNN-NNNNNNNNNNNN\\}"
and my text property is set to: "{49f93de5-1da6-4e3a-a2e4-64795dc89ebb}"
When I run my program the curly braces are missing from the screen's edit field (but the hyphens are present and character masks are correctly applied). How can I show the { and } ? I assumed escaping them in the mask was all that was necessary.
I think your problem relates to this
Edited: wrapping the input string in qsTr()
allows the curly braces to show in the input text.
in QML I use TextInput and it works :
import QtQuick 2.14
import QtQuick.Window 2.14
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
TextInput {
id: textInput
x: 116
y: 94
width: 237
height: 53
text: qsTr("{49f93de5-1da6-4e3a-a2e4-64795dc89ebb}")
font.pixelSize: 12
inputMask: ">\\{NNNNNNNN-NNNN-NNNN-NNNN-NNNNNNNNNNNN\\}"
}
}