Ignore empty roles for textRect calculation

Avoids a text rect taller than the area that actually contains text,
as can be seen by hovering files in a folder with "additional roles"
that a given file does not contain.
This commit is contained in:
Kai Uwe Broulik 2022-02-23 20:27:33 +01:00
parent d774088a52
commit cd81906550

View file

@ -1319,7 +1319,11 @@ void KStandardItemListWidget::updateIconsLayoutTextCache()
textInfo->staticText.setTextWidth(maxWidth);
const QRectF textRect(padding + (maxWidth - requiredWidth) / 2, y, requiredWidth, lineSpacing);
m_textRect |= textRect;
// Ignore empty roles. Avoids a text rect taller than the area that actually contains text.
if (!textRect.isEmpty()) {
m_textRect |= textRect;
}
y += lineSpacing;
}