Skip to content

Commit

Permalink
fix hickup in search display when tabs are present
Browse files Browse the repository at this point in the history
  • Loading branch information
sunderme committed Nov 7, 2023
1 parent efb1d21 commit d882eab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/searchresultwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,15 @@ void SearchTreeDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
}

// draw text
QString text = index.data().toString();
QString text = index.data().toString();
text.replace("\t"," ");
QList<SearchMatch> matches = index.data(SearchResultModel::MatchesRole).value<QList<SearchMatch> >();

int pos = 0;
foreach (SearchMatch match, matches) {
// text before match
QString part = text.mid(pos, match.pos - pos);
int w = UtilsUi::getFmWidth(painter->fontMetrics(), part);
int w = UtilsUi::getFmWidth(painter->fontMetrics(), part);
painter->drawText(r, Qt::AlignLeft | Qt::AlignTop | Qt::TextSingleLine, part);
r.setLeft(r.left() + w + 1);
// matched text
Expand Down

0 comments on commit d882eab

Please sign in to comment.