PDA

View Full Version : Setting border color and onclick() event for selected word



ejoshva
2nd June 2015, 07:05
Below is the code for highlighting the selected text


findText(str);
page()->setContentEditable(true);
QColor m_Color;
m_Color.setNamedColor(hcolorlist[index]);
QString clrName = m_Color.name();
QLatin1String cmd = QLatin1String("HiliteColor");
QString js = QString(QLatin1String("document.execCommand(\"%1\",null, \"%2\")")).arg(cmd).arg(clrName);
QVariant va = page()->mainFrame()->evaluateJavaScript(js);
page()->setContentEditable(false);


"str" in the code is the selected word.

I want set border color and onclick() event for the selected word

I have heard that its possible using <span> tag. But not sure how to apply it here.
Is there anyother way, border and onclick() event could be implemented