如何在输入字段中获取用户输入?
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");
}
}
}
如果我设置了属性,它会起作用,但我想捕捉用户输入,有什么想法吗?