Highlight All line in QTextBrowser
I use this code below to highlight the select text in text Browser.
the var selectLine have a text to highlight, but i want select all line width in editor with this text not just a selected text
Code:
void MyHighlighter
::highlightBlock(const QString &text
) {
myClassFormat.setBackground(backColor);
myClassFormat.
setProperty(QTextFormat::FullWidthSelection,
true);
int index = text.indexOf(expression);
while (index >= 0) {
int length = expression.matchedLength();
setFormat(index, length , myClassFormat);
index = text.indexOf(expression, index + length);
}
}
}
how can I do IT?