Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Press left mouse button on ui->webView. How?

Press left mouse button on ui->webView. How?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 4 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    yo22
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      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.

      157

      1 Reply Last reply
      0
      • G Offline
        G Offline
        guru
        wrote on last edited by
        #3

        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..

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Adrien Leravat
          wrote on last edited by
          #4

          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.

          Adeneo Embedded - www.adeneo-embedded.com

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved