1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-12 00:54:20 +02:00

* No need for font mumbo-jumbo in sidebar.

This commit is contained in:
Christian Muehlhaeuser
2014-08-23 12:42:10 +02:00
parent bfff7b2878
commit 17f69bfd65

View File

@@ -215,11 +215,7 @@ void
SourceDelegate::paintCollection( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const SourceDelegate::paintCollection( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
{ {
painter->save(); painter->save();
QFont normal = option.font;
QFont bold = option.font;
painter->setPen( Qt::black ); painter->setPen( Qt::black );
// bold.setBold( true );
SourceTreeItem* item = index.data( SourcesModel::SourceTreeItemRole ).value< SourceTreeItem* >(); SourceTreeItem* item = index.data( SourcesModel::SourceTreeItemRole ).value< SourceTreeItem* >();
SourcesModel::RowType type = static_cast< SourcesModel::RowType >( index.data( SourcesModel::SourceTreeItemTypeRole ).toInt() ); SourcesModel::RowType type = static_cast< SourcesModel::RowType >( index.data( SourcesModel::SourceTreeItemTypeRole ).toInt() );
@@ -256,7 +252,7 @@ SourceDelegate::paintCollection( QPainter* painter, const QStyleOptionViewItem&
if ( status && colItem && !colItem->source().isNull() ) if ( status && colItem && !colItem->source().isNull() )
{ {
tracks = QString::number( colItem->source()->trackCount() ); tracks = QString::number( colItem->source()->trackCount() );
figWidth = QFontMetrics( normal ).width( tracks ); figWidth = painter->fontMetrics().width( tracks );
if ( shouldDrawDropHint ) if ( shouldDrawDropHint )
figWidth = iconRect.width(); figWidth = iconRect.width();
name = colItem->source()->friendlyName(); name = colItem->source()->friendlyName();
@@ -264,9 +260,6 @@ SourceDelegate::paintCollection( QPainter* painter, const QStyleOptionViewItem&
avatar = colItem->pixmap( iconRect.size() ); avatar = colItem->pixmap( iconRect.size() );
/* if ( status || colItem->source().isNull() )
painter->setFont( bold );*/
isPlaying = !( colItem->source()->currentTrack().isNull() ); isPlaying = !( colItem->source()->currentTrack().isNull() );
desc = colItem->source()->textStatus(); desc = colItem->source()->textStatus();
if ( colItem->source().isNull() ) if ( colItem->source().isNull() )
@@ -284,15 +277,12 @@ SourceDelegate::paintCollection( QPainter* painter, const QStyleOptionViewItem&
if ( trackCount >= 0 ) if ( trackCount >= 0 )
{ {
tracks = QString::number( trackCount ); tracks = QString::number( trackCount );
figWidth = QFontMetrics( normal ).width( tracks ); figWidth = painter->fontMetrics().width( tracks );
} }
name = scItem->collection()->itemName(); name = scItem->collection()->itemName();
} }
avatar = scItem->icon().pixmap( iconRect.size() ); avatar = scItem->icon().pixmap( iconRect.size() );
painter->setFont( bold );
desc = qobject_cast< Tomahawk::ScriptCollection* >( scItem->collection().data() )->description(); desc = qobject_cast< Tomahawk::ScriptCollection* >( scItem->collection().data() )->description();
} }
@@ -316,7 +306,6 @@ SourceDelegate::paintCollection( QPainter* painter, const QStyleOptionViewItem&
painter->drawText( textRect, text, to ); painter->drawText( textRect, text, to );
} }
painter->setFont( normal );
textRect = option.rect.adjusted( iconRect.width() + 28, option.rect.height() / 2, -figWidth - ( figWidth ? 24 : 0 ), -6 ); textRect = option.rect.adjusted( iconRect.width() + 28, option.rect.height() / 2, -figWidth - ( figWidth ? 24 : 0 ), -6 );
if ( type == SourcesModel::Collection ) if ( type == SourcesModel::Collection )