Commit 20431e3b authored by Jakob Leben's avatar Jakob Leben

Qt: iconView delegate: encode PLModel::IsCurrent(QModelIndex) into cache key

This way item is redrawn when current item changes.
parent 13942d47
...@@ -82,7 +82,8 @@ void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt ...@@ -82,7 +82,8 @@ void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
// picture where all the rendering happens and which will be cached // picture where all the rendering happens and which will be cached
QPixmap pix; QPixmap pix;
QString key = title + artist + artUrl; QString key = title + artist + artUrl
+ QString( index.data( PLModel::IsCurrentRole ).toInt() );
if(QPixmapCache::find( key, pix )) if(QPixmapCache::find( key, pix ))
{ {
// cool, we found it in the cache // cool, we found it in the cache
......
...@@ -346,6 +346,7 @@ QVariant PLModel::data( const QModelIndex &index, int role ) const ...@@ -346,6 +346,7 @@ QVariant PLModel::data( const QModelIndex &index, int role ) const
QFont f; f.setBold( true ); return QVariant( f ); QFont f; f.setBold( true ); return QVariant( f );
} }
} }
else if( role == IsCurrentRole ) return QVariant( isCurrent( index ) );
return QVariant(); return QVariant();
} }
......
...@@ -54,6 +54,10 @@ class PLModel : public QAbstractItemModel ...@@ -54,6 +54,10 @@ class PLModel : public QAbstractItemModel
friend class PLItem; friend class PLItem;
public: public:
enum {
IsCurrentRole = Qt::UserRole
};
PLModel( playlist_t *, intf_thread_t *, PLModel( playlist_t *, intf_thread_t *,
playlist_item_t *, QObject *parent = 0 ); playlist_item_t *, QObject *parent = 0 );
~PLModel(); ~PLModel();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment