From d84c5da4e9274858196b984134250009daed2b78 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 10 Feb 2022 09:22:17 +0100 Subject: [PATCH] Core: Limit rendering of tag rows in ListItemDelegate Unlimited rows make the tags flow over the lower edge. Two rows should be enough for proper tagging. All tags are still used for searching, even if some are omitted in the rendering. Change-Id: Ia731031f362165c75ef5fa34a80200c85d2f93aa Reviewed-by: Christian Stenger --- src/plugins/coreplugin/welcomepagehelper.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/coreplugin/welcomepagehelper.cpp b/src/plugins/coreplugin/welcomepagehelper.cpp index d363fdf6656..3519cb9ab58 100644 --- a/src/plugins/coreplugin/welcomepagehelper.cpp +++ b/src/plugins/coreplugin/welcomepagehelper.cpp @@ -522,11 +522,14 @@ void ListItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti painter->setPen(themeColor(Theme::Welcome_LinkColor)); m_currentTagRects.clear(); + int emptyTagRowsLeft = 2; int xx = 0; int yy = 0; for (const QString &tag : item->tags) { const int ww = fm.horizontalAdvance(tag) + tagsHorSpacing; if (xx + ww > textArea.width() - tagsLabelRect.width()) { + if (--emptyTagRowsLeft == 0) + break; yy += fm.lineSpacing(); xx = 0; }