Important: Please read the Qt Code of Conduct -

qtvirtualkeyboard not registering keys correctly

  • This is the strangest issue I have seen with qml. We have data entry widgets in qml that when you click on them they will bring up the virtual keyboard as expected. However, when trying to press keys on the keyboard the widget will not register a press. However, if you put your finger somewhere else on the touchscreen and then press a key on the keyboard it will register. Is there some sort of multitouch attribute or option on the virtualkeyboard?

  • I was able to reproduce this issue. I do not know if this is good code to begin with, but the following will reliably show the problem we are seeing in our other app.

    In order to quit you will have to alt-f4, or whatever the close app keypress is on your system.

    You will find after clicking in the text area that you cannot use the virtualkeyboard to enter values unless you simultaneously press somewhere else on the screen at the same time. This requires a touchscreen to see this. Mouse clicks work just fine.


    #include <QGuiApplication>
    #include <QApplication>
    #include <QQmlApplicationEngine>
    #include <QDir>
    #include <QQmlComponent>
    #include <QDebug>
    #include <QMainWindow>
    #include <QQuickWidget>
    int main(int argc, char *argv[])
        qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
        QApplication app(argc, argv);
        QMainWindow *m_MainWindow = new QMainWindow();
        QQuickWidget *m_QuickWidget = new QQuickWidget(m_MainWindow);
        return app.exec();


    import QtQuick 2.2
    import QtQuick.Window 2.2
    import QtQuick.Controls 1.3
    import QtGraphicalEffects 1.0
    import QtQuick.VirtualKeyboard 2.1
    import QtQuick.Dialogs 1.2
    Item {
        id: startup
        visible: true
        width: 1920
        height: 1080
        StackView {
            id: startup_stack
            anchors.fill: parent
            focus: true
            initialItem: main_view
            delegate: StackViewDelegate {
                pushTransition: StackViewTransition {
                        PropertyAnimation {
                            target: enterItem
                            property: "opacity"
                            from: 0
                            to: 1
                            duration: 500
                    PropertyAnimation {
                        target: exitItem
                        property: "opacity"
                        from: 1
                        to: 0
                        duration: 100
        Component {
            id: main_view
            TextInput {
                width: 320
                height: 50
                text: "Default"
        VirtualKB_def {}


    import QtQuick 2.9
    import QtQuick.VirtualKeyboard 2.2
    import QtQuick.VirtualKeyboard.Settings 2.2
    InputPanel {
        id: inputPanel
        z: 99
        x: 0
        y: parent.height
        width: parent.width
        //Component.onCompleted: VirtualKeyboardSettings.styleName = "retro"
        //Component.onCompleted: VirtualKeyboardSettings.styleName = "test"
        states: State {
            name: "visible"
            PropertyChanges {
                target: inputPanel
                y: parent.height - inputPanel.height
        transitions: Transition {
            from: ""
            to: "visible"
            reversible: true
            ParallelAnimation {
                NumberAnimation {
                    properties: "y"
                    duration: 250
                    easing.type: Easing.InOutQuad

  • @fcarney Hit same issue. Did you solve it by any chance? Thanks in advance!

  • @fanat9 Honestly I don't remember. We took a different route since then. Also using a different version of Qt now. 5.12 instead of 5.9 (or whatever we were using).

  • @fcarney I'm trying 5.13.2 atm. Could you please look into your old sources if you still have them.

Log in to reply