QML Keyboard for touch screen
-
There is exists Backspace key on the top/right corner.
-
And you just do text += <the backspace code> ?
-
No. This is just UI. It sends signal which of key is pressed.
In case of backspace pressed it sends sigButtonPressed ('backspace').
Your application should handle it.
You can see it from my example. -
Can I use it with QML TextInput ?
-
Yes. You can manual handle sigButtonPressed and in case of button=='backspace' remove character just before cursorPosition of the TextInput.
-
Isnt there is something more generic that use sendEvent(QKeyEvent) that simulate the real Keyboard ?
-
In my example I do
QCoreApplication::postEvent(_target, key_event_press);
QCoreApplication::postEvent(_target, key_event_release);that, I believe, emulate click on to the key.
-
What is the _target ? Is it the TextInput ?
-
It is QWidget object, that setted by client and accept QKeyEvent
-
Did you try it with a QML Item ?
-
No, I didn't. What's difference between QML Item and QWidget*?
If you can obtain QTextInput QWidget pointer (and you can), than it'll be work. -
I try it and it din't work
-
Ok, as soon as I have time I'll check it.
-
Thanks.
I'll wait -
you can also try maliit. Its a full framework for input methods. Has virtual keyboards also. I think they have QML keyboards as well now.
-
What is maliit ?
-
see here https://wiki.maliit.org/Main_Page
-
For sending emulated events to QML items, see http://qt-project.org/forums/viewthread/17360/
-
i know its pretty late,
but i just stumbled upon colibri and i had (as rodrigob) quite a hard time to figure how to use clkeyboard together with a lineedit. But it is possible by
letting the lineedit read the keyboard internal text.
So basically the lineedit is just used to show a text which belongs to the keyboard itself!@CLLineEdit{
id: textInput
text: keyboard.text
}
Rectangle{
height: 100
width: 200
color: "black"
CLKeyboard{
id: keyboard
anchors.fill: parent
}
}
@