1
votes

I'd like to install a virtual keyboard on my QtQuickApplication using an Input Panel :

import QtQuick.VirtualKeyboard 2.1
    InputPanel {
        id: inputPanel
        anchors.fill: parent
        focus: true
    }

I have no mouse (nor touchscreen) on my system. I only have a small keyboard (max 10 buttons) to control my GUI.

I'd like to select and type keys from a virtual keyboard using the qml code.

Is there any way to control the virtual keyboard using some qml code ?

1
how do you want to control the virtual keyboard if you nave no real keyboard no mouse?folibis
Since I am working on an embedded system, my inputs are limited to few buttons. I'd like to use these buttons (or combination of buttons) to navigate into my InputPanel and to select keys I'd like to write.tthibalti
You can try to bind your keys to a real keys in C++. QKeyEvent *event = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Enter, Qt::NoModifier); QCoreApplication::postEvent (engine->rootObjects().first(), event);folibis
Thank you for your answer. Unfortunately I can't code every key with my few buttons. I'd like to use them to control the virtual keyboard. Do you mean it's possible to navigate into the virtual keyboard using real Key Events ?tthibalti
I rewrote the question to be clearertthibalti

1 Answers

0
votes

I found a solution thanks to folibis.

Qt virtual keyboard can be controlled using arrow keys but it has to be compiled again using CONFIG+=arrow-key-navigation as described in this topic :
How to use arrows to navigate through a QtVirtualKeyboard

and in this Qt documentation :
https://stackguides.com/questions/54719106/how-to-use-arrows-to-navigate-through-a-qtvirtualkeyboard

Then, as folibis said in his previous comment, arrow key events can be simulated using QKeyEvent objects : QKeyEvent *event = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Enter, Qt::NoModifier); QCoreApplication::postEvent (engine->rootObjects().first(), event);