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"

Qt Code:
  1. void applyHighlight(QString str, QString color)
  2. {
  3. findText(str);
  4. * m_Color.setNamedColor(color.toUpper());
  5. QString clrName = m_Color.name();
  6. QLatin1String cmd = QLatin1String("HiliteColor");
  7. QString js = QString(QLatin1String("document.execCommand(\"%1\",false, \"%2\")")).arg(cmd).arg(clrName);
  8. page()->runJavaScript(js);
  9. }
To copy to clipboard, switch view to plain text mode 

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