Press left mouse button on ui->webView. How?
yo22 last edited by
I have in qt app webView in Ui.
bq. ui->webView->load(QUrl("http://google.com")); QCursor::setPos(60,320); QMouseEvent mouseEvent(QEvent::MouseButtonPress,QCursor :: pos(),Qt::LeftButton,Qt::LeftButton,Qt::NoModifier ); QApplication::sendEvent(this, &mouseEvent);
How i can press button mouse?
What do you want to do exactly ?
Clicking a left mouse button on a link on a webpage loaded in webview will open that link.
guru last edited by
why using mouse event, whats the purpose of it. If you have any link in webview then your mouse left button will work, otherwise it can't work..
Adrien Leravat last edited by
If you are building tests (assuming you're using Qt5), then have a look at "Qt 5 TestLib":http://qt-project.org/doc/qt-5.0/qttestlib/qtest-overview.html. It also exists within Qt4. You can simulate mouse and keyboard events with it.
If you are trying to simulate mouse events, try sending it to "ui->webView" instead of this. Careful of mouse coordinates, you'll have to use coordinates local to your target widget if I remember well.