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:
@@ -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() );
|
||||
|
||||
Reference in New Issue
Block a user