mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-20 07:49:42 +01:00
* Don't even try to paint invalid GridItems.
This commit is contained in:
parent
5c9b1cbfe8
commit
408b104b8d
@ -82,16 +82,13 @@ void
|
||||
GridItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
||||
{
|
||||
PlayableItem* item = m_model->sourceModel()->itemFromIndex( m_model->mapToSource( index ) );
|
||||
if ( !item )
|
||||
if ( !item || !index.isValid() )
|
||||
return;
|
||||
|
||||
QStyleOptionViewItemV4 opt = option;
|
||||
initStyleOption( &opt, QModelIndex() );
|
||||
qApp->style()->drawControl( QStyle::CE_ItemViewItem, &opt, painter );
|
||||
|
||||
painter->save();
|
||||
painter->setRenderHint( QPainter::Antialiasing );
|
||||
|
||||
QRect r = option.rect;
|
||||
QString top, bottom;
|
||||
if ( !item->album().isNull() )
|
||||
@ -105,11 +102,18 @@ GridItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
{
|
||||
top = item->artist()->name();
|
||||
}
|
||||
else
|
||||
else if ( !item->query().isNull() )
|
||||
{
|
||||
top = item->query()->track();
|
||||
bottom = item->query()->artist();
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
painter->save();
|
||||
painter->setRenderHint( QPainter::Antialiasing );
|
||||
|
||||
if ( !m_covers.contains( index ) )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user