1

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?

howc0me
  • 11
  • 1
  • It's not exactly the same question, but you might find an answer here: http://stackoverflow.com/questions/27894769/how-to-send-artificial-qkeyevent-to-qwebengineview – MrEricSir Jan 31 '17 at 03:09

0 Answers0