Fix weird label line generation in the instance view.

This commit is contained in:
Petr Mrázek 2013-06-23 22:45:36 +02:00
parent 27b1de0d6d
commit 38fb702e78

View File

@ -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 )
{