How to use virtual keyboard on Raspberry Pi 4
-
Is there a way to check whether it is eglfs or x11?
I am not very good at Linux.===============================================
I tried the option to change the qt platform.
export QT_QPA_PLATFORM="x11"qt.qpa.plugin: Could not find the Qt platform plugin "x11" in "" This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, webgl, xcb.
Do I need to install x11?
Is there a command to find out which platform is currently set? -
@IknowQT said in How to use virtual keyboard on Raspberry Pi 4:
Is there a way to check whether it is eglfs or x11?
Your plugin debug output will show which platform plugin was loaded.
I tried the option to change the qt platform.
export QT_QPA_PLATFORM="x11"Use QT_QPA_PLATFORM="xcb"
-
@IknowQT said in How to use virtual keyboard on Raspberry Pi 4:
I tried again after changing to xcb platform, but the virtual keyboard still does not work.
See my earlier post:
Now, modify that example code: Convert the
QGuiApplication
into aQApplication
, and then create + show aQTextEdit
. What happens when you click on the QTextEdit? What happens when you click on one of the fields in the QQuickView? -
#include <QQuickView> #include <QGuiApplication> #include <QQmlEngine> #include <QtWidgets/QApplication> int main(int argc, char *argv[]) { qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard")); QGuiApplication app(argc, argv); QApplication n = qobject_cast<QApplication>(app); QQuickView view(QString("qrc:/%2").arg(MAIN_QML)); if (view.status() == QQuickView::Error) return -1; view.setResizeMode(QQuickView::SizeRootObjectToView); view.show(); return app.exec(); }
Are you talking about converting QGuiApplication to QApplication?
An error occurs. >: -
@IknowQT said in How to use virtual keyboard on Raspberry Pi 4:
An error occurs. >:
And what is the error?
-
@IknowQT said in How to use virtual keyboard on Raspberry Pi 4:
QGuiApplication app(argc, argv);
QApplication n = qobject_cast<QApplication>(app);What is this actually?!
Why not simply
QApplication app(argc, argv);
?
-
@jsulm
I didn't quite understand what you mean to convert QguiApplication.@JKSH
The keyboard works normally when you follow the steps you mentioned.int main(int argc, char *argv[]) { qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard")); QApplication app(argc, argv); //QApplication app2 = static_cast<QApplication>(app); QQuickView view(QString("qrc:/%2").arg(MAIN_QML)); if (view.status() == QQuickView::Error) return -1; view.setResizeMode(QQuickView::SizeRootObjectToView); view.show(); return app.exec(); }
-
@IknowQT said in How to use virtual keyboard on Raspberry Pi 4:
The keyboard works normally when you follow the steps you mentioned.
I also said:
...create + show a QTextEdit. What happens when you click on the QTextEdit? What happens when you click on one of the fields in the QQuickView?
-
-
@IknowQT said in How to use virtual keyboard on Raspberry Pi 4:
I tried what you did, the result is that once you click on lineedit made into widget the keyboard appears
...
It seems certain that the keyboard reacts when lineEdit is clicked.
Great! You now have Qt Virtual Keyboard working with a QWidget.
However, the keyboard appears within the quick screen UI area.
I'm not sure what you mean -- the keyboard is always meant to appear in the bottom half of the screen.
-
I popped up a UI called form and clicked lineEdit. The virtual keyboard appears, but it does not appear in the form widget, but in the quick view.
int main(int argc, char *argv[]) { qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard")); QApplication app(argc, argv); //QApplication app2 = static_cast<QApplication>(app); Form* f = new Form(); f->show(); QQuickView view(QString("qrc:/%2").arg(MAIN_QML)); if (view.status() == QQuickView::Error) return -1; view.setResizeMode(QQuickView::SizeRootObjectToView); view.show(); return app.exec(); }
-
@IknowQT said in How to use virtual keyboard on Raspberry Pi 4:
@JKSH
If you don't know, answer that you don't know
I think it's a courtesy to anyone waiting for an answer.I'm sorry for keeping you waiting without a response.
I don't know why your virtual keyboard appears inside the Qt Quick window; I was planning to investigate but my RPi was deployed to another task.