mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
LocationCompleter: Draw light line at the bottom of item
- also space between title and link is now 2px bigger because of underlining
This commit is contained in:
parent
179d173bcf
commit
0437ae171f
@ -105,12 +105,16 @@ void LocationCompleterDelegate::paint(QPainter* painter, const QStyleOptionViewI
|
||||
drawHighlightedTextLine(titleRect, title, searchText, painter, style, opt, colorRole);
|
||||
|
||||
// Draw link
|
||||
const int infoYPos = titleRect.bottom() + opt.fontMetrics.leading();
|
||||
const int infoYPos = titleRect.bottom() + opt.fontMetrics.leading() + 2;
|
||||
QRect linkRect(titleRect.x(), infoYPos, titleRect.width(), opt.fontMetrics.height());
|
||||
QString link(opt.fontMetrics.elidedText(index.data(Qt::DisplayRole).toString(), Qt::ElideRight, linkRect.width()));
|
||||
painter->setFont(opt.font);
|
||||
|
||||
drawHighlightedTextLine(linkRect, link, searchText, painter, style, opt, colorLinkRole);
|
||||
|
||||
// Draw line at the very bottom of item
|
||||
QRect lineRect(opt.rect.left(), opt.rect.bottom(), opt.rect.width(), 1);
|
||||
painter->fillRect(lineRect, opt.palette.color(QPalette::AlternateBase));
|
||||
}
|
||||
|
||||
bool sizeBiggerThan(const QString &s1, const QString &s2)
|
||||
@ -276,7 +280,8 @@ QSize LocationCompleterDelegate::sizeHint(const QStyleOptionViewItem &option, co
|
||||
|
||||
const QFontMetrics titleMetrics(titleFont);
|
||||
|
||||
m_rowHeight = 2 * m_padding + opt.fontMetrics.leading() + opt.fontMetrics.height() + titleMetrics.height();
|
||||
// 2 px bigger space between title and link because of underlining
|
||||
m_rowHeight = 2 * m_padding + opt.fontMetrics.leading() + opt.fontMetrics.height() + titleMetrics.height() + 2;
|
||||
}
|
||||
|
||||
return QSize(200, m_rowHeight);
|
||||
|
Loading…
Reference in New Issue
Block a user