TextField and custom virtual keyboard not compatible ?
-
Hello,
I'm making a Virtual Keyboard because I can't use the one provided with Qt (because my target is an embedded system that does not support it).
The keyboard seems to works fine but I have an issue when I use a TextField as destination of Keyboard input.
My first attempt was on a TextEdit. But I want to use it on a TextField as well. But it does not work.
Here is how my virtual keyboard is working :
I implemented a cpp method that send an Event, here is a sample of what I'm sending :
event = new QKeyEvent(QEvent::KeyPress, k, Qt::NoModifier, lbl); QCoreApplication::sendEvent(target, event);On the qml side I have a TextField, once I gain focus on the TextField I update my "target" in order to send the event to the focused field.
onFocusChanged: if (focus) keyboard.setTarget(this, false) //If focus on the TextField the textfield become the newTarget, the boolean is a value I use to know is my field is numeric or notThis seems to be enough on TextEdit but not on TextField do you have any idea what can cause this difference ?
If you need any more element please ask me I'll provide it.
Thank you for any help.
-
I believe I just found out why. From the info I found the TextField contains a TextEdit, that means that once I focus the TextField I do not focus the TextEdit and I can't send events to the right target.
Is there anyway to focus the textEdit inside a TextField ?