Important: Please read the Qt Code of Conduct -

How to make inputMask with QML

  • Hi, what I need is an inputMask of this format: 0000.00. When I click the buttons (0-9), the TextInput should change accordingly. I tried it like this, but it didn't function:

    TextInput {
    id: displayNumbers6Text
    inputMask: "0000.00"
    color: "#ffffff"

    Buttons have MouseArea, for example for Number 2:

    MouseArea {
    anchors.fill: parent
    onPressed: {parent.buttonColor = "#a0c119"}
    onReleased: {parent.buttonColor = "#000000"}
    onClicked: {
    displayNumbers6Text.inputMask = displayNumbers6Text.inputMask + "2"
    cursorShape: Qt.PointingHandCursor

    Please help!

Log in to reply