PDA

View Full Version : Run QtVirtualKeyboard using QQuickWidget



pvb
22nd June 2017, 15:35
Hi all,

I am trying to make the QtVirtualKeyboard example work with QQuickWidget instead of QQuickView. For QuickView, I use the following main.cpp code, which works fine for me:


#include <QQuickView>
#include <QGuiApplication>
#include <QQmlEngine>

int main(int argc, char *argv[])
{
qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));

QGuiApplication app(argc, argv);

QQuickView view(QString("qrc:/%2").arg(MAIN_QML));
view.setResizeMode(QQuickView::SizeRootObjectToVie w);
view.show();

return app.exec();
}

I run into problems, when changing to QQuickWidgets with the following implementation of main.cpp:


#include <QQuickWidget>
#include <QApplication>
#include <QQmlEngine>

int main(int argc, char *argv[])
{
qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));

QApplication app(argc, argv);

QQuickWidget w(QString("qrc:/%2").arg(MAIN_QML));
w.setResizeMode(QQuickWidget::SizeRootObjectToView );
w.show();

return app.exec();
}

When I hit the input fields, the virtual keyboard shows up, but when I start typing at the keyboard, I get the message "input method is not set", which seems to be related to the input method plugin. No chars appear in the input fields.
Any ideas? The QML-code didn't change between the above variants of main.cpp

BTW: I am using Linux, gcc, Qt 5.9.0, EGLFS plugin

Thanks for any suggestions!

Regards,
Patrick

pvb
26th June 2017, 08:20
I did some further tests and the same code works with Qt 5.8.0, but fails on 5.9.0

AlekseyK
14th May 2020, 11:02
Solution is here: https://stackoverflow.com/a/61793240/630169