Elide long parameter names

Elide long parameter names if needed.
This commit is contained in:
Michael Gregorius
2023-07-09 17:33:35 +02:00
parent db3df4a8f5
commit 73a6c5b313

View File

@@ -67,8 +67,13 @@ void BarModelEditor::paintEvent(QPaintEvent *event)
// Draw the text into the value rectangle but move it slightly to the right
QRect const textRect = valueRect.marginsRemoved(QMargins(3, 0, 0, 0));
// Elide the text if needed
auto const fm = fontMetrics();
QString const elidedText = fm.elidedText(m_text, Qt::ElideRight, textRect.width());
painter.setPen(textColor);
painter.drawText(textRect, m_text);
painter.drawText(textRect, elidedText);
}
} // namespace lmms::gui