From 1c5d57dce99b6ddbab0f46600a6a2f69608fdca5 Mon Sep 17 00:00:00 2001 From: Umcaruje Date: Sun, 13 Mar 2016 22:50:30 +0100 Subject: [PATCH] Elide channel names to prevent text overflow in FxLine --- src/gui/widgets/FxLine.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/FxLine.cpp b/src/gui/widgets/FxLine.cpp index 11267534a..249afdf0a 100644 --- a/src/gui/widgets/FxLine.cpp +++ b/src/gui/widgets/FxLine.cpp @@ -152,7 +152,11 @@ void FxLine::drawFxLine( QPainter* p, const FxLine *fxLine, const QString& name, // draw the channel name if( m_staticTextName.text() != name ) { - m_staticTextName.setText( name ); + // elide the name of the fxLine when its too long + const int maxTextHeight = 78; + QFontMetrics metrics( fxLine->font() ); + QString elidedName = metrics.elidedText( name, Qt::ElideRight, maxTextHeight ); + m_staticTextName.setText( elidedName ); } p->rotate( -90 );