Handle cases where elided text becomes empty or "..."

Render the whole text if the elided text becomes empty or if it only
contains one character, i.e. if it becomes "…". Solved as implemented
because I was not able to check for "…" explicitly, i.e. the comparison
against "…" still failed.
This commit is contained in:
Michael Gregorius
2017-07-18 19:52:17 +02:00
parent f15fe18360
commit a81b14b6cf

View File

@@ -656,6 +656,11 @@ void TrackContentObjectView::paintTextLabel(QString const & text, QPainter & pai
QFontMetrics fontMetrics(labelFont);
QString elidedPatternName = fontMetrics.elidedText(text, Qt::ElideMiddle, width() - 2 * textLeft);
if (elidedPatternName.length() < 2)
{
elidedPatternName = text.trimmed();
}
painter.fillRect(QRect(0, 0, width(), fontMetrics.height() + 2 * textTop), textBackgroundColor());
painter.setPen( textColor() );