PDA

View Full Version : WebEngineView->findText()



ejoshva
17th June 2015, 07:58
I am using QWebEngineView to display the .html page.

I try to use findText to find where the search text is found on the loaded page.



bool textFound;
findText(QStringLiteral("Experience"), QWebEnginePage::FindFlags(), [this](bool found) { textFound = found;});
if(textFound)
{
// do my processing
}


When I execute this code, getting error as below
error: expected expression
findText(QStringLiteral("Experience"), QWebEnginePage::FindFlags(), [this](bool found) { qDebug()<<"inside";});
^

Kindly help me resolve this issue.

aamer4yu
17th June 2015, 08:48
Dont you need to call the findText function via an object ??

ejoshva
17th June 2015, 10:06
I am calling this from inside the webengineview class

ejoshva
17th June 2015, 12:10
void WebEngineView::foundText(bool value)
{
textFound = value;
}

void searchText()
{
findText(QStringLiteral("exception"), QWebEnginePage::FindFlags(),
[=](bool found) { foundText(found); }
);
}



This is the code which works