1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-19 15:29:42 +01:00

* Set font before calculating elided text.

This commit is contained in:
Christian Muehlhaeuser 2014-08-21 18:16:47 +02:00
parent bf1877fbfd
commit be31baf7a8

View File

@ -148,6 +148,15 @@ SourceDelegate::paintStandardItem( QPainter* painter, const QStyleOptionViewItem
iconRect.setWidth( iconRect.height() );
painter->drawPixmap( iconRect, opt.icon.pixmap( iconRect.size(), iconMode ) );
if ( selected )
{
QFont f = painter->font();
f.setBold( true );
// f.setPointSize( 10 );
painter->setFont( f );
painter->setPen( Qt::black );
}
QRect textRect = opt.rect.adjusted( iconRect.width() + 22, 0, -32, 0 );
QString text = painter->fontMetrics().elidedText( upperCase ? opt.text.toUpper() : opt.text, Qt::ElideRight, textRect.width() );
{
@ -163,16 +172,6 @@ SourceDelegate::paintStandardItem( QPainter* painter, const QStyleOptionViewItem
painter->setPen( Qt::black );
}
if ( selected )
{
QFont f = painter->font();
f.setBold( true );
f.setPointSize( 10 );
painter->setFont( f );
painter->setPen( Qt::black );
// opt.palette.setColor( QPalette::Text, option.palette.color( QPalette::HighlightedText ) );
}
painter->drawText( textRect, text, to );
}
}