Virtual Keyboard and WebAssembly
-
I need to work whit a virtual keyboard in my WebAssembly project.
in qt examples there is only one example showed here:
https://doc.qt.io/qt-6/qtvirtualkeyboard-index.html
Now, I build this example in Desktop modality and works fine.
But when I build it in WebAssembly, this program don't work!
When I click on lineinput item, the virtual Keyboard appair for a very short time, then disappair.
But if I click on dialog body the keyboard reappair magically and disappair.
First Question: is this the correct behaviour?
I created a similar project using QWidget. this program works in Desktop modality.
Don't work in webaasembly modality.
The Keyboard is never dispalyed.
I tried to change the the windowModality properties and nothing is changed.
https://forum.qt.io/topic/123986/modal-dialogs-break-virtual-keyboard
Second Question: Wich is the correct mode to use the qtvirtualkeyboard in a WebAssembly project
In the tecnical guide,
https://doc.qt.io/qt-6/technical-guide.html
isn't explained how to include this plugin into the project#include "DialogSandBox.h" #include <QApplication> int main(int argc, char *argv[]) { qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard")); QApplication a(argc, argv); DialogSandBox w; w.show(); return a.exec(); }
-
In Qt 6.4 the native virtual keyboard on mobile has been improved, so you won't necessarily need the qt virtual keyboard for wasm.
-
@lorn-potter im using 6.4 , on android browsers keyboard keyboard comes up but no typing. and for ios keyboard not open !!!
-
@lorn-potter Same Problem. Use 6.4.1 wasm and native Keyboard. In textfild Keyboard occurs, but no press is moving to qt... Do you have a solution?
Stefan -
I'm still experiencing this problem in 6.5, and I'm checking 6.6 now. Has anyone managed to get virtual keyboard input working? I can force it to appear, but it does not send events to input fields. I get a "input method is not set" error message in the console, which suggests the virtual keyboard does not detect the field is focused. I'm testing mostly in firefox/chrome on desktop, but when I tested on mobile the behavior was the same.
-
@brett-dalton
The Qt virtual keyboard works with widget apps. I am currenty looking at a bug where it is not working with declarative apps, but that one is that it doesn't show at all. -
Yes I've been working with a QT Quick app. As you say, the keyboard doesn't appear normally, but I forced it to be visible. In my App.qml file I have modified the auto-generated InputPanel:
InputPanel { id: inputPanel property bool showKeyboard : active //y: showKeyboard ? parent.height - height : parent.height y: parent.height - height // ... }
Not that this fixes the keyboard. It still can't be used to enter text. But when I press a key I see an error "input method is not set" in the browser console. I'm not familiar with the input system, but maybe that's useful info for your debugging,
I will try to see if I can get the keyboard working with a QML widget in a widget app. Maybe that will be a suitable workaround.
-
@brett-dalton
Did you find a solution?