qtqmlqtvirtualkeyboard

Show VirtualKeyboard in Dialog


I am using qtvirtualkeyboard module with qml. I use the following qml code to show the virtual keyboard.

import QtQuick 2.5
import QtQuick.VirtualKeyboard 2.1

    InputPanel {
        id: inputPanel
        y: Qt.inputMethod.visible ? parent.height - inputPanel.height : parent.height
        anchors.left: parent.left
        anchors.right: parent.right
        focus: true
    }

When I call that qml in a dialog with modal configuration as true, I can't touch the keyboard. If the dialog modal configuration is false then I can touch keyboard but this time the dialog is hidden. Also I want that the user can control only keyboard on dialog screen.

How can I control virtual keyboard on dialog screen?


Solution

  • If I understood the problem correctly, then this is likely the same issue as QTBUG-56918. As mentioned by JP in the comments of that bug report, a possible workaround (for Qt Quick Controls 2 applications) is to set parent: root.overlay and z: 1 on the InputPanel to raise it above the popup (or dialog).