QML Keyboard for touch screen
-
rodrigob, I've made a simple virtual keyboard for touchscreen displays.
There are also some example to use it with Qt.
https://projects.developer.nokia.com/vk -
How do you delete letters with this keyboard ?
-
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/