Virtual keyboard does not show up in QWidgets app on RPi 2
-
Hi and welcome to devnet,
You can run your application with the
QT_DEBUG_PLUGINS
environment variable set to 1. This should give you more clues as to why the VK is not shown.Hope it helps
-
Thank you for the advice, @SGaist! I compared the logs of all three cases. In all of them QVirtualKeyboardPlugin is loaded properly, but in my application on the Raspberry there are a number of plugins not being loaded which are loaded on the desktop and the Basic example, including QtVirtualKeyboardStylesPlugin and several QML/QtQuick related plugins. How can I make them load or find out why they don't get loaded?
-
Check that you have everything available on your target.
-
Today I cross-recompiled and reinstalled the whole Qt 5.7.1 toolkit on the target. Then I compiled the virtualkeyboard/basic example again as well as my own application shown above using exactly the same toolchain. Still, my application only loads QVirtualKeyboardPlugin but not the remaining ones. And they are available on the target - virtualkeyboard/basic loads all of them flawlessly. I still have no clue what causes this discrepancy.
-
Did you compare the .pro files ?
Did you check with ldd the plugins that don't load on your target ? -
OK, I finally figured out why it doesn't work as I would like it to. Apparently, in non-desktop environments like EGLFS it is necessary to create an
InputPanel
with QML. So I guess it is impossible to write an application the traditional, QtWidgets-based way if you want to use Qt's virtual keyboard without X11. On the desktop, the only thing you need to do is to setQT_IM_MODULE=qtvirtualkeyboard
and it just works out of the box. -
@mr_max as a workaround you can use a QQuickWidget to contain the input panel.
-
Thank you! Yes, InputPanel was what was needed to make the VirtualKeyboard actually show on embedded (eglfs_kms or wayland). Then it also needs a y and width. And then it is always visible by default, so I guess need to bind visible: active.
The code shown on this page, i.e. without InputPanel, "just worked" on desktop (except the virtual keyboard was massive), but not embedded
https://doc.qt.io/qt-6/qtvirtualkeyboard-basic-example.html
and the "Detailed Description" here didn't really explain why/when to use it
https://doc.qt.io/qt-6/qml-qtquick-virtualkeyboard-inputpanel.html