Context: I'm creating a web browser. I need to send mouse events to the web page.
It was working with Qt WebKit, but now some sites doesn't work with QT WebKit. So, I need to move my web brouser to Qt WebEngine. But my old solution for QMouseEvent don't work.
Solution for QWebView:
void MainWindow::simClick(int x, int y) {
QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(x, y), Qt::LeftButton,
Qt::LeftButton, Qt::NoModifier);
QCoreApplication::sendEvent(ui->webView, &pressEvent);
QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(x, y), Qt::LeftButton,
Qt::LeftButton, Qt::NoModifier);
QCoreApplication::sendEvent(ui->webView, &releaseEvent);
}
This problem can be solved by using JavaScript, but I need exactly QMouseEvent.
How to send mouse events to the QWenEnginePage?