QtWebkit and QWebElement - Get user input?

how can i get userinput in input field?

QObject::connect( webView, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted()) ); void slotLoadStarted() { QWebFrame *frame = webView->page()->currentFrame(); if (frame!=NULL) { QWebElementCollection collection = frame->findAllElements("input[name=email]"); foreach (QWebElement element, collection) { qDebug() << "element.toOuterXml" << element.toOuterXml(); qDebug() << "element.attribute value:" << element.attribute("value"); } } 

}

if I set the attribute, how does it work, but I want to catch user input, any ideas?

+4
source share
2 answers

You can use QWebElement :: evaluateJavaScript () .

 qDebug() << "element.attribute value:" << element.evaluateJavaScript("this.value").toString(); 
+6
source

There seems to be a bug about this issue. I suggest that one way around this would be to create an onKeyPress event handler in JavaScript that updates some hidden element with the changed value that you use to read the value from Qt code.

+1
source

All Articles