Need help to code VirtualKeyboard using QQuickWidget on Widget-based app
-
@raven-worx said
yes, if you want to use it with QtWidgets.
An InputPanel QML element can also show a virtualkeyboard using EGLFS.So far so good!
I have managed to cross compileQt v5.12.3
onRaspbian stretch@Raspberry Pi3B+
withoutEGLFS
and withEGL on X11
and all Virtual Keyboard plugins are deployed correctly based on Deployment Guide BUT VK won't run and if we setQT_DEBUG_PLUGINS
to true only$$[QT_INSTALL_PLUGINS]/platforminputcontexts/libqtvirtualkeyboardplugin.so
is loaded(full log).
So do you have any clue about what's wrong?
Regards.Hope to get to a solution on this topic for anyone else
-
@iman4k
did you setQT_IM_MODULE=qtvirtualkeyboard
env variable?
How do you start your application? With what parameters and or platform plugin?
Do you see your application in your X11 display? -
@raven-worx said in Need help to code VirtualKeyboard using QQuickWidget on Widget-based app:
@iman4k
did you setQT_IM_MODULE=qtvirtualkeyboard
env variable?
How do you start your application? With what parameters and or platform plugin?
Do you see your application in your X11 display?- Yes, before
QApplication
creation in the main function:qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
./<my-app> -platform xcb
- Not sure about seeing application on X11 display but yes my app running normally(windowed) just like the desktop-x86 one.
- Yes, before
-
Also for more debugging when I set
qputenv("QT_LOGGING_RULES", QByteArray("qt.virtualkeyboard=true"));
, the VK's logs
forraspberry
is like this :qt.virtualkeyboard: Loading extension "japanese" qt.virtualkeyboard: Loading extension "traditional_chinese" qt.virtualkeyboard: Loading extension "pinyin" qt.virtualkeyboard: Loading extension "thai" qt.virtualkeyboard: Loading extension "hangul" qt.virtualkeyboard: PlatformInputContext::setFocusObject(): QLineEdit(0x7ec96790) qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll) qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImInputItemClipRectangle) qt.virtualkeyboard: PlatformInputContext::setFocusObject(): QLineEdit(0x7ec96790) qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll) qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll) qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll) qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll) qt.virtualkeyboard: PlatformInputContext::showInputPanel() qt.virtualkeyboard: PlatformInputContext::commit() qt.virtualkeyboard: PlatformInputContext::commit() qt.virtualkeyboard: PlatformInputContext::hideInputPanel() qt.virtualkeyboard: PlatformInputContext::setFocusObject(): QObject(0x0) qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll)
So
showInputPanel()
is called but actually is not shown! and couldn't find the reason.
And these logs are for running on Desktop:qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImInputItemClipRectangle) qt.virtualkeyboard: PlatformInputContext::setFocusObject(): QLineEdit(0x7ffe8952fa60) qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll) qt.virtualkeyboard: InputContext::setFocus(): true qt.virtualkeyboard: PlatformInputContext::setFocusObject(): QLineEdit(0x7ffe8952fa60) qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll) qt.virtualkeyboard: InputContext::setLocale(): "en_GB" qt.virtualkeyboard: PlatformInputContext::setLocale(): QLocale(English, Latin, UnitedKingdom) qt.virtualkeyboard: InputEngine::setInputMethod(): QtVirtualKeyboard::PlainInputMethod(0x1110b60) qt.virtualkeyboard: InputEngine::setInputMode(): 0 qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll) qt.virtualkeyboard: PlatformInputContext::showInputPanel() qt.virtualkeyboard: DesktopInputPanel::repositionView(): QRect(55,24 1865x1056) qt.virtualkeyboard: PlatformInputContext::hideInputPanel() qt.virtualkeyboard: PlatformInputContext::commit() qt.virtualkeyboard: PlatformInputContext::commit() qt.virtualkeyboard: PlatformInputContext::setFocusObject(): QObject(0x0) qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll) qt.virtualkeyboard: InputContext::setFocus(): false qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImInputItemClipRectangle) qt.virtualkeyboard: PlatformInputContext::setFocusObject(): QLineEdit(0x7ffe8952fa60) qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll) qt.virtualkeyboard: InputContext::setFocus(): true qt.virtualkeyboard: PlatformInputContext::setFocusObject(): QLineEdit(0x7ffe8952fa60) qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll) qt.virtualkeyboard: PlatformInputContext::commit() qt.virtualkeyboard: PlatformInputContext::commit() qt.virtualkeyboard: InputContext::setFocus(): false
-
@raven-worx
Any idea or hint would be appreciated.
Regards. -
@iman4k
seems you somehow loosing input-focus in your non-working case?
are you running the exact same application on desktop and on your pi?
any other output in the console? -
@raven-worx said in Need help to code VirtualKeyboard using QQuickWidget on Widget-based app:
@iman4k
seems you somehow loosing input-focus in your non-working case?
are you running the exact same application on desktop and on your pi?
any other output in the console?- No, input focus is just fine and the lineedit will get focus as expected(the last 3 line of logs in the non-working case is because I clicked on the outside of widget area at the end)
- Yes, the exact same application is running on
Desktop
and also onEmbedded(raspberry)
kit - Nothing more than those logs I mentioned!
This is somehow strange, it took 1 week struggling on this :(
-
@iman4k
then i guess either something in your application or your used Qt installation.
Just to amke sure: I assume - becasue of the log output - the qtvirtualkeyboard plugin is available on your Pi?
are you also using QML in your application or is it a pure QtWidget application? -
@raven-worx said in Need help to code VirtualKeyboard using QQuickWidget on Widget-based app:
@iman4k
then i guess either something in your application or your used Qt installation.
Just to amke sure: I assume - becasue of the log output - the qtvirtualkeyboard plugin is available on your Pi?
are you also using QML in your application or is it a pure QtWidget application?-
Yes, these are deployed on the pi side in install step of cross-compile:
/usr/local/qt5pi/plugins/platforminputcontexts/libqtvirtualkeyboardplugin.so
/usr/local/qt5pi/qml/QtQuick/VirtualKeyboard/libqtquickvirtualkeyboardplugin.so
/usr/local/qt5pi/qml/QtQuick/Layouts/libqquicklayoutsplugin.so
/usr/local/qt5pi/lib/libQt5VirtualKeyboard.so
So I assume the plugin is available.
-
It's a simple
QtWidgets
application:
#include <QtWidgets> int main(int argc, char *argv[]) { qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard")); qputenv("QT_LOGGING_RULES", QByteArray("qt.virtualkeyboard=true")); QApplication a(argc, argv); QMainWindow w; QLineEdit edit(&w); edit.move(50, 50); w.show(); return a.exec(); }
Is this problem related to
Openbox
WindowManager?
I'm also curious to know whyDesktopInputPanel::repositionView(): QRect(55,24 1865x1056)
is not called afterPlatformInputContext::showInputPanel()
in raspberry? -
-
Hi,
similar problem exists here.
Did you eventually found a solution for the problem, that you remember?I run into it on a buildroot issue without desktop manager.
Currently I suspect a problem with the interpreting system input events by QApplication.
Seems that QGuiApplication does something different.