filcuc / nimqml

Qt Qml bindings for the Nim programming language
Other
161 stars 20 forks source link

How to process key-events? #19

Closed R3D9477 closed 6 years ago

R3D9477 commented 6 years ago

@filcuc Hi. Is it possible to process key-events of TextField? Specially, how to cancel append of key? For example qml:

    TextField {
        id: tfExpr
        x: 10
        y: 24
        width: 184
        height: 40
        text: mainWindow.exprBuff
        horizontalAlignment: Text.AlignRight
        Keys.onPressed: mainWindow.tfKeyPressed(event)
    }

nim-handler:

  proc tfKeyPressed*(self: MainWindowHandler, event: QVariant) {.slot.} =
    ???

I think theme can be resolved inside QML (via functions/connections).

I'll close this issue, but theme is interest: is it possible to process with QML object in Nim-side (for example get or set some property at runtime by it's name)?