qml中TextInput的最小字符数

Minimum chars of TextInput in qml

我正在尝试像 00:00 那样自定义 TimePicker。为了让它看起来像这样,我需要在 TextInput 中设置最小字符数。
现在,如果是午夜,我会得到 0:0,这是不合适的。

有什么办法让它好看吗?

我认为您正在寻找这样的东西:

TextInput {
    inputMask: "00:00:00"
    cursorVisible: true
    inputMethodHints: Qt.ImhTime
    text: "00:00:00"
}