Goal: Responsive multitouch rectangle with WebEngineView inside.
I'm making multitouch web browser. For now I made browser in rectangle with multitouch area over it that coresponds to some mutitouch actions with rectangle resizing, and on short tap sends javascript with click event through runJavaScript function to webpage. But it has problem for example with google forms thats rejects js inputs. So i try to build click simulation in qt.
Code of simulator.
QMouseEvent * event1 = new QMouseEvent (QEvent::MouseButtonPress, QPoint(x,y),
Qt::MiddleButton,
Qt::MiddleButton,
Qt::NoModifier );
bool resp1 = QCoreApplication::sendEvent(mainWindow,event1);
QMouseEvent * event2 = new QMouseEvent (QEvent::MouseButtonRelease, QPoint(x,y),
Qt::MiddleButton,
Qt::MiddleButton,
Qt::NoModifier );
bool resp2 = QCoreApplication::sendEvent(mainWindow,event2);
It works on some cases but not all of them. The problem is that mainWindow is the ApplicationWindow, so x are x of browser rectangle + x of touch in rectangle, and similar with y.
Im using MiddleButton in this click simulation, and this is the problem. Not every web button receives midle button click as submit click. So i need to pass LEFT button click directly to webengineview. But when i do this application crashes, because multitoucharea receives it first as touch and sends one again to click simulation. It creates infinity loop.
The question is: How to send simulated LEFT click directly to WebEngineView?
Ok... I found answer. MultiPointTouchArea has property mouseEnabled. When is false, then mouse events are ignored by touch component.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With