mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 06:07:37 +02:00
* Set font before calculating elided text.
This commit is contained in:
@@ -148,6 +148,15 @@ SourceDelegate::paintStandardItem( QPainter* painter, const QStyleOptionViewItem
|
|||||||
iconRect.setWidth( iconRect.height() );
|
iconRect.setWidth( iconRect.height() );
|
||||||
painter->drawPixmap( iconRect, opt.icon.pixmap( iconRect.size(), iconMode ) );
|
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 );
|
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() );
|
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 );
|
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 );
|
painter->drawText( textRect, text, to );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user