Commit 5b5fbf9b authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

Make sure bold characters are not just randomly highlighted

parent 387b0088
......@@ -97,9 +97,14 @@ public:
QTextDocument doc;
QString str = index.data().toString();
for (const auto c : m_filterString) {
const QRegularExpression re (QStringLiteral("(")+QRegularExpression::escape(c)+QStringLiteral(")"), QRegularExpression::CaseInsensitiveOption);
str.replace(re, QStringLiteral("<b>\\1</b>"));
int j = 0;
for (int i = 0; i < str.size() && j < m_filterString.size(); ++i) {
if (str.at(i) == m_filterString.at(j)) {
str.replace(i, 1, QStringLiteral("<b>") + str.at(i) + QStringLiteral("</b>"));
i += 7;
++j;
}
}
doc.setHtml(str);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment