Added highlighting for completion in name column.
This commit is contained in:
parent
9582162927
commit
5085844550
@ -196,13 +196,10 @@ class CompletionItemDelegate(QStyledItemDelegate):
|
||||
|
||||
if index.parent().isValid():
|
||||
pattern = index.model().pattern
|
||||
if index.column() == 0 and pattern:
|
||||
repl = r'<span class="highlight">\g<0></span>'
|
||||
text = re.sub(re.escape(pattern), repl, self._opt.text,
|
||||
flags=re.IGNORECASE)
|
||||
self._doc.setHtml(text)
|
||||
else:
|
||||
self._doc.setPlainText(self._opt.text)
|
||||
repl = r'<span class="highlight">\g<0></span>'
|
||||
text = re.sub(re.escape(pattern), repl, self._opt.text,
|
||||
flags=re.IGNORECASE)
|
||||
self._doc.setHtml(text)
|
||||
else:
|
||||
self._doc.setHtml('<b>{}</b>'.format(html.escape(self._opt.text)))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user