Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    [Qt 4.7.4] Interaction between Qt WebKit and all web pages.

    Qt WebKit
    1
    1
    3214
    Loading More Posts
    • 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.
    • P
      Pepete last edited by

      Hi,

      My goal is to add a virtual keyboard when my user clic on the input text of the web page.

      I use initialLayoutCompleted() which call my function test() and put for each input text "onclick","formExtractor.recupSelection(this.id, this.type, this.name, this.value);".

      @connect(ui.webView->page()->mainFrame(), SIGNAL(initialLayoutCompleted()),this, SLOT(test()));@

      @void FormExtractor::test(){
      QWebFrame *frame = ui.webView->page()->mainFrame();

      QWebElementCollection webElementCollection = frame->findAllElements("input[type=text]");
      foreach(QWebElement webElement , webElementCollection){
          webElement.setAttribute("onclick","formExtractor.recupSelection(this.id, this.type, this.name, this.value);");
      }
      

      }@

      Then in my function recupSelection, i check if one of webElements founded :

      @
      void FormExtractor::recupSelection(QString id, QString type, QString name, QString value){
      QWebFrame *frame = ui.webView->page()->mainFrame();

      QWebElementCollection webElementCollection = frame->findAllElements("input[type=text]");
      foreach(QWebElement webElement , webElementCollection){
          if(webElement.attribute("id") == id && webElement.attribute("name") == name && webElement.attribute("value") == value){
              qDebug() << "TROUVE";
              webElement.setAttribute("value","LOL");
          }
      }
      
      qDebug() << " type : " << type << "; Nom id : " << id << "; Nom name : " << name << " ; value : " << value;
      

      }
      @

      But it's not working for all website ... What can i do ?

      1 Reply Last reply Reply Quote 0
      • First post
        Last post