diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-06-23 22:45:36 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-06-23 22:45:36 +0200 |
commit | 38fb702e7828ce61c6cc0e39985e8d665c960071 (patch) | |
tree | 37b65a3d4dd041d733b29d6cd8d726c9fc16e6d1 | |
parent | 27b1de0d6d196d9d0f6c284e0cb772c077688c3e (diff) | |
download | MultiMC-38fb702e7828ce61c6cc0e39985e8d665c960071.tar MultiMC-38fb702e7828ce61c6cc0e39985e8d665c960071.tar.gz MultiMC-38fb702e7828ce61c6cc0e39985e8d665c960071.tar.lz MultiMC-38fb702e7828ce61c6cc0e39985e8d665c960071.tar.xz MultiMC-38fb702e7828ce61c6cc0e39985e8d665c960071.zip |
Fix weird label line generation in the instance view.
-rw-r--r-- | gui/instancedelegate.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gui/instancedelegate.cpp b/gui/instancedelegate.cpp index 86b7d399..4c7a3a3a 100644 --- a/gui/instancedelegate.cpp +++ b/gui/instancedelegate.cpp @@ -11,11 +11,14 @@ static void viewItemTextLayout ( QTextLayout &textLayout, int lineWidth, qreal & height = 0; widthUsed = 0; textLayout.beginLayout(); + QString str = textLayout.text(); while ( true ) { QTextLine line = textLayout.createLine(); if ( !line.isValid() ) break; + if(line.textLength() == 0) + break; line.setLineWidth ( lineWidth ); line.setPosition ( QPointF ( 0, height ) ); height += line.height(); @@ -191,11 +194,11 @@ void ListViewDelegate::paint ( QPainter* painter, const QStyleOptionViewItem& op textLayout.setText ( opt.text ); qreal width, height; - viewItemTextLayout ( textLayout, iconbox.width(), height, width ); + viewItemTextLayout ( textLayout, textRect.width(), height, width ); const int lineCount = textLayout.lineCount(); - const QRect layoutRect = QStyle::alignedRect ( opt.direction, opt.displayAlignment, QSize ( iconbox.width(), int ( height ) ), textRect ); + const QRect layoutRect = QStyle::alignedRect ( opt.direction, opt.displayAlignment, QSize ( textRect.width(), int ( height ) ), textRect ); const QPointF position = layoutRect.topLeft(); for ( int i = 0; i < lineCount; ++i ) { |