QT5 QWebView openlink head info lost



  • im use QT5.3.2,now have a problem,im use QWebView,i want use code click hyperlink on the html page,but head data loted,pls help me ,how to code ,head data don't lost,thanks. im try ui->webView->pageAction(QWebPage::OpenLink); but i don't know how to set the url.


  • Moderators

    taken from the Qt docs:
    @
    QWebElement document = frame->documentElement();
    /* Assume that the document has the following structure:

         <form name="myform" action="submit_form.asp" method="get">
             <input type="text" name="myfield">
             <input type="submit" value="Submit">
         </form>
    
      */
    
     QWebElement button = document.findFirst("input[type=submit]");
     button.evaluateJavaScript("this.click()");
    

    @

    Somehow you need to find your desired element with a selector with findFirst()


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.