mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-20 07:49:42 +01:00
* Fixed text-alignment in TreeItemDelegate.
This commit is contained in:
parent
7b89645718
commit
5e0748a1f9
@ -61,6 +61,9 @@ TreeItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
if ( !item )
|
||||
return;
|
||||
|
||||
QTextOption textOption( Qt::AlignVCenter | (Qt::Alignment)index.data( Qt::TextAlignmentRole ).toUInt() );
|
||||
textOption.setWrapMode( QTextOption::NoWrap );
|
||||
|
||||
QString text;
|
||||
if ( !item->artist().isNull() )
|
||||
{
|
||||
@ -120,9 +123,8 @@ TreeItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
|
||||
painter->setPen( o.palette.text().color() );
|
||||
|
||||
QTextOption to( Qt::AlignVCenter );
|
||||
QString text = painter->fontMetrics().elidedText( index.data().toString(), Qt::ElideRight, r.width() - 3 );
|
||||
painter->drawText( r.adjusted( 0, 1, 0, 0 ), text, to );
|
||||
painter->drawText( r.adjusted( 0, 1, 0, 0 ), text, textOption );
|
||||
}
|
||||
painter->restore();
|
||||
}
|
||||
@ -174,12 +176,9 @@ TreeItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
|
||||
painter->drawPixmap( r, cover );
|
||||
|
||||
QTextOption to;
|
||||
to.setAlignment( Qt::AlignVCenter );
|
||||
|
||||
r = option.rect.adjusted( option.rect.height(), 6, -4, -option.rect.height() + 22 );
|
||||
text = painter->fontMetrics().elidedText( text, Qt::ElideRight, r.width() );
|
||||
painter->drawText( r, text, to );
|
||||
painter->drawText( r, text, textOption );
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user