I am working on an application to be deployed as a wasm app and a windows application.
we are using a windows 10 OS touch screen tablet and google chrome to access the web app. am using an empty new qt project to demonstrate the problem :
The onscreen Keyboard popups up regardless of focus meaning it will pop up wherever i touch the screen:
- if btn is pressed
- if lineedit is selected
- if empty widget space is touched even though there is no focus object behind it.
i include a link to this Behaviour Video so you can see the problem.
the onscreen Keyboard popup without focus problem occurs only if i compile for webassembly, works fine on the same tablet for MSVC.
what i tried :
- catch the events then ignore them using :
ui->centralwidget->installEventFilter(this);
bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
//print event to qdebug
static int eventEnumIndex = QEvent::staticMetaObject.indexOfEnumerator("Type");
QString TEXT_Event = QEvent::staticMetaObject.enumerator(eventEnumIndex).valueToKey(event->type());;
qDebug()<<"TEXT EVENT="<<TEXT_Event;
if(TEXT_Event.contains("Paint")){
//dont show print event
}else{
ui->Main_PlainTextEdit->appendPlainText(obj->objectName()+"=>"+TEXT_Event);
}
if( event->type()==QEvent::MouseButtonPress|| event->type()==QEvent::MouseButtonRelease)
{
// handle on-screen keyboard
event->ignore();
event->accept();
}
return true;
}
- setAttribute(Qt::WA_TransparentForMouseEvents);
not OK as it deactivates all mouse input => no interaction possible,
- setAttribute(Qt::WA_AcceptTouchEvents);
This only changes the event from Mouse event to touch event.
Maybe there is an option that i need to tick in the form editor or touchscreen option that needs to be activated, maybe the way to catch and ignore event i implemented is wrong.
I don't know what i am doing wrong but all my attempts to fix this didn't work, please help guide me ?
Thank you in advance.