Как назначить TextInput для int, в qml? - PullRequest
2 голосов
/ 01 июля 2011

Как мне назначить TextInput для int в qml?

int new_span_seconds

TextInput {
        id: editor
        width: 80
        height: 17
        color: "white"
        font.bold: true; font.pixelSize: 14
        text: "21"
        horizontalAlignment: TextInput.AlignHCenter

    }

    Keys.forwardTo: [ (returnKey), (editor)]

    Item {
        id: returnKey
        Keys.onReturnPressed: new_span_seconds = editor. <<< ?  >>>
        Keys.onEnterPressed:  new_span_seconds = editor. <<< ?  >>>
    }

1 Ответ

3 голосов
/ 03 июля 2011

Это просто кусок Javascript

Keys.onReturnPressed: new_span_seconds = parseInt(editor.text)
...