- enhancement: adjust tab order in the find dialog

- enhancement: highlight hits in the find panel's result list
This commit is contained in:
Roy Qu 2022-03-11 17:13:07 +08:00
parent ff1d3abc16
commit 42af39d28f
2 changed files with 14 additions and 4 deletions

View File

@ -2,6 +2,8 @@ Red Panda C++ Version 1.0.0
- fix: calculation for code snippets's tab stop positions is not correct
- fix: Refresh files view shouldn'tchange open/save dialog's default folder
- enhancement: "locate in files view" will request user's confirmation when change the working folder
- enhancement: adjust tab order in the find dialog
- enhancement: highlight hits in the find panel's result list
Red Panda C++ Version 0.14.5
- fix: the "gnu c++ 20" option in compiler set options is wrong

View File

@ -460,14 +460,22 @@ void SearchResultTreeViewDelegate::paint(QPainter *painter, const QStyleOptionVi
x+=metrics.horizontalAdvance(text);
QFont font = option.font;
font.setBold(true);
font.setItalic(true);
QFont oldFont = painter->font();
painter->setFont(font);
text=item->text.mid(item->start-1,item->len);
int width = metrics.horizontalAdvance(text);
QFont oldFont = painter->font();
QPen oldPen = painter->pen();
painter->setPen(qApp->palette().color(QPalette::ColorRole::HighlightedText));
painter->setFont(font);
QRect rect = textRect;
rect.setLeft(x);
rect.setWidth(width);
painter->fillRect(rect,qApp->palette().color(QPalette::ColorRole::Highlight));
painter->drawText(x,y,text);
metrics = QFontMetrics(font);
x+=metrics.horizontalAdvance(text);
x+=width;
painter->setFont(oldFont);
painter->setPen(oldPen);
text = item->text.mid(item->start-1+item->len);
painter->drawText(x,y,text);
}