Solved virtualkeyboard can not be triggered by using touch screen
-
hi,
recently, I am using qtvirtualkeyboard as input method, but when I want use touch screen to edit QTextEdit content, the virtualkeyboard would not be triggered by touch the screen, but if i use mouse click the QTextEdit, the virtualkeyboard will come out
-
Hi,
Which version of Qt ?
On which device ?
Does the touchscreen work otherwise ?
Do you have the same issue for a QLineEdit ? -
@SGaist
thank you
my Qt version is Qt5.12.10
I am using nvidia jetson tx2
the touch is working, and I tried QLineEdit and QSpinBox, all the same.and I am not using gnome desktop, I am using xsession to run my qt application when the system start
-
When you say all the same, do you mean none of them triggers the virtual keyboard ?
Is your touchscreen seen as a mouse ?
Can you interact with a button through it ? -
@SGaist thanks.
Yes, none of the editable widget triggers the virtual keyboard by touch screen, but can triggers the virtual keyboard by click mouse left button.
I use following code to check my touch screenvoid TextEdit::mousePressEvent(QMouseEvent *event) { qDebug() << __FUNCTION__ << event->button(); QTextEdit::mousePressEvent(event); }
and it print " TextEdit::mousePressEvent Qt::LeftButton ", same as click mouse left button,
and I can use my touch screen to click button, it work with buttons -
@SGaist
hi
I found is I call activateWindow() before showing my window, the virtualkeyboard can come out, but it will focus my first editable widget and show the virtualkeyboard automatically. -
Some more questions:
- are you using Qt's virtual keyboard ?
- does your touch screen act normally with your other applications ?
-
@SGaist said in virtualkeyboard can not be triggered by using touch screen:
are you using Qt's virtual keyboard ?
hi
- I have use following command before running my application.
export QT_IM_MODULE=qtvirtualkeyboard
and I can see qtvirtualkeyboard by clicking editable widget by mouse
- I tested my touch screen on gnome desktop with qt application, it worked, but if i run the qt application by x11 session directly , the qt application can detect left button clicked but can not focus the editable widget , and can not trigger the qt virtualkeyboard. but if I using mouse to trigger it once or call activateWindow() before showing the window, the virtualkey board can be triggered by my touch screen after that, but if i call activateWindow() the window will focus on my editable widget automaticly and the qt virtualkeyboard will also come out , I want to use the virtualkey board when I touch the editable widget.
thanks for your help
-
What do you mean by X11 session directly ?
-
@SGaist
I want to boot to qt application like embedded system, rather than boot to gnome desktop then run qt application.
so I changed the xsession configuration replace gnome desktop to run my qt application.
It is kind of like boot2qt (https://doc.qt.io/archives/qt-5.13-devicecreation/index.html) -
So one single application ?
Then you will likely have to do some configuration yourself with regards to input handling.See the Qt for embedded Linux chapter in Qt's documentation.
-
installEventFilter( this ); to check if touch event is triggered at first?
-
@JoeCFD
hi,
I tried to use installEventFilter( this ); to check if touch event is triggered, and I got QMouseEvent which button() is Qt::LeftButton -
Yes, one single application, and thanks for your advice.
I am not sure I am using the right way to just run an application without desktop enviroment.
Do i need to change platform like eglfs or wayland? I am now using xcb, my system is ubuntu18.04 and my device is jetson tx2 -
If you do not want any desktop environment, eglfs would make more sense.
-
@SGaist
ok, thank you very much -
If you use virtualkeyboard by embedding qml file to the QQuickWidget, In touch screen situation, you need to set this: ui->quickWidget->setAttribute(Qt::WA_AcceptTouchEvents)