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



  • 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 ?


Log in to reply
 

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