Unsolved 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.
main.cpp:
#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")); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication app(argc, argv); QMainWindow *m_MainWindow = new QMainWindow(); m_MainWindow->setWindowFlags(Qt::FramelessWindowHint); m_MainWindow->setAttribute(Qt::WA_NoSystemBackground); m_MainWindow->setAttribute(Qt::WA_OpaquePaintEvent); QQuickWidget *m_QuickWidget = new QQuickWidget(m_MainWindow); m_QuickWidget->setSource(QUrl("qrc:/startup.qml")); m_MainWindow->showFullScreen(); return app.exec(); }
startup.qml:
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 {} }
VirtualKB_def.qml:
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" when: inputPanel.active 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.