Search code examples
qtqmlqtvirtualkeyboard

How to / What to Query to get value of current QtVirtualKeyboard Input Method


Can anyone tell me what property I can check to determine the active input method (i.e. handwriting, keyboard, etc.)?

Basically, I'm looking to have some logic like:

if (inputMethod === "handwriting") {
    //do this
} else {
    //do that
}

or

if (handwriting.active) {
    //do this
} else {
    //do that
}

I have read through all of the documentation for InputMethod, InputEngine, and InputContext and, unfortunately, a description like, "provides access to an input context" isn't helpful.

It tells me what the QML type has... but not what it is. Additionally, within the properties of two of the three QML types, the other two QML types are accessible, which seems a bit random and circular to me and only adds to my confusion.


Solution

  • Can be done several ways depending on your keyboard implementation. Easiest way I see is using HandwritingInputPanel's active property or detect a HandwritingModeKey press.