PDA

View Full Version : WebEngineView - highlight issue.



ejoshva
14th July 2015, 12:29
I am trying to highlight the selected text in QWebEngineView.
Issue is all the matches are highlighted and along with the one I selected.
Also the color is some default color. The one I selected is one color and rest matches in "yellow"



void applyHighlight(QString str, QString color)
{
findText(str);
* m_Color.setNamedColor(color.toUpper());
QString clrName = m_Color.name();
QLatin1String cmd = QLatin1String("HiliteColor");
QString js = QString(QLatin1String("document.execCommand(\"%1\",false, \"%2\")")).arg(cmd).arg(clrName);
page()->runJavaScript(js);
}


Kindly help me to highlight only the text which I have selected.