Important: Please read the Qt Code of Conduct -

Virutal Keyboard

  • Hi,
    I am developing cross application (Windows and Linux) that can be installed on computers with touch screen.
    I so need to create a virtual keyboard. But the only examples that I found they taking the focus only from the parent widget, but when I try to edit tables (lose focus as soon as I click on a button), and especially when using the QFileDialog (is modal) the keyboard is unusable.
    I need a keyboard similar to that of windows, are there some examples?
    There are other better ways?
    Thank you

  • Are you using QtWidgets or QtQuick?

  • I'm using QtWidgets.

  • Moderators

    any reason why you don't use

    Qt Virtual Keyboard used to be commercial licenz only but that changed with the last update, same as QChart

  • @J-Hilk : In linux I use the 5.5.1 version that does not have the Qt Virtual Keyboard, even in Windows that use the 5.7.0 is not present. I downloaded it from the website and now try to see how it works.
    Question: It works well on desktops? Reading quickly seems more made for mobile than for a desktop application.

  • Moderators

    Sadly I have no Idea, so far I had no need for an custom Virtual Keyboard. Usually I use the one the OS-provides or a hardware one :)

    But I don't see why it shouldn't work on desktops.

  • I'm trying to use, unfortunately, I don't understand how insert in my project and how to customize it. I'm using QTWidgets and C ++, not QML or QtQuick, and I find only examples in QML. In the documentation it says that it works on C ++.

  • Yep Qt Virtual Keyboard is QML only, hence my question above.

    You could try something like but it's almost impossible to internationalise

  • Ok, so I need to use my old keyboard.
    My original problem is the focus

    VirtualKeyboard *pVirtKey = new VirtualKeyboard(this);
    // VirtualKeyboard.cpp
    QApplication::sendEvent(m_pParent->focusWidget(), &keyEventIns);

    In this way from its parent (for example QMainWindow) I take the object that has the focus. I would not use this method but simply take the focus of the selected object, not passing a parent, Can I do this?

    I modify this projet

Log in to reply