Qt 6.11 is out! See what's new in the release
blog
QT 5.9.4 - virtualkeyboard problems
-
Hi,
I am struggling with qtvirtualkeyboard on embedded linux device with qt 5.9.4
I created a start.qml file which looks as follows:
import QtQuick 2.9 import QtQuick.Window 2.3 import QtQuick.Controls 2.2 import QtQuick.VirtualKeyboard 2.1 ApplicationWindow { width: 800 height: 1280 flags: Qt.FramelessWindowHint visible: true Item { id: root width: 800 height: 1280 visible: true Item { id: appContainer anchors.left: parent.left anchors.top: parent.top anchors.right: parent.right anchors.bottom: inputPanel.top TextField { x: 10 y: 10 color: "#192e4c" maximumLength: 8 inputMethodHints: Qt.ImhDigitsOnly | Qt.ImhHiddenText focus: true onActiveFocusChanged: { if (activeFocus) { Qt.inputMethod.update(Qt.ImQueryInput) } } } } InputPanel { id: inputPanel y: Qt.inputMethod.visible ? parent.height - inputPanel.height : parent.height anchors.left: parent.left anchors.right: parent.right } } }and this works as expected - there is a keyboard with digits only and I can enter digits to the TextField.
If I modify my qml as follows and try to use my TextField in stacked qml there is a full keyboard showing on the screen and each key press generates an "input method is not set" message on the terminal. Digits are not entered into TextField.
import QtQuick 2.9 import QtQuick.Controls 2.2 import QtQuick.VirtualKeyboard 2.1 ApplicationWindow { width: 800 height: 1280 flags: Qt.FramelessWindowHint visible: true Item { id: root width: 800 height: 1280 visible: true Item { id: appContainer anchors.left: parent.left anchors.top: parent.top anchors.right: parent.right anchors.bottom: inputPanel.top StackView { id: stack anchors.left: parent.left anchors.top: parent.top anchors.right: parent.right anchors.bottom: parent.bottom initialItem: "qrc:/test.qml" } } InputPanel { id: inputPanel y: Qt.inputMethod.visible ? parent.height - inputPanel.height : parent.height anchors.left: parent.left anchors.right: parent.right } } }This is the content of test.qml pushed on stack
import QtQuick 2.9 import QtQuick.Controls 2.2 Item { width: 800 height: 1280 TextField { x: 10 y: 10 color: "#192e4c" maximumLength: 8 inputMethodHints: Qt.ImhDigitsOnly | Qt.ImhHiddenText focus: true onActiveFocusChanged: { if (activeFocus) { Qt.inputMethod.update(Qt.ImQueryInput) } } } }Regards,
Michal