From: Jakob Leben Date: Thu, 28 Jan 2010 19:08:50 +0000 (+0100) Subject: Qt: iconView delegate: encode PLModel::IsCurrent(QModelIndex) into cache key X-Git-Tag: 1.1.0-ff~758 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=20431e3be581bf2a513f223bc98c93619bb623c9;p=vlc Qt: iconView delegate: encode PLModel::IsCurrent(QModelIndex) into cache key This way item is redrawn when current item changes. --- diff --git a/modules/gui/qt4/components/playlist/icon_view.cpp b/modules/gui/qt4/components/playlist/icon_view.cpp index 856cbd65d3..7e63ebe33e 100644 --- a/modules/gui/qt4/components/playlist/icon_view.cpp +++ b/modules/gui/qt4/components/playlist/icon_view.cpp @@ -82,7 +82,8 @@ void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt // picture where all the rendering happens and which will be cached QPixmap pix; - QString key = title + artist + artUrl; + QString key = title + artist + artUrl + + QString( index.data( PLModel::IsCurrentRole ).toInt() ); if(QPixmapCache::find( key, pix )) { // cool, we found it in the cache diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp index 455291888b..f9c87628ff 100644 --- a/modules/gui/qt4/components/playlist/playlist_model.cpp +++ b/modules/gui/qt4/components/playlist/playlist_model.cpp @@ -346,6 +346,7 @@ QVariant PLModel::data( const QModelIndex &index, int role ) const QFont f; f.setBold( true ); return QVariant( f ); } } + else if( role == IsCurrentRole ) return QVariant( isCurrent( index ) ); return QVariant(); } diff --git a/modules/gui/qt4/components/playlist/playlist_model.hpp b/modules/gui/qt4/components/playlist/playlist_model.hpp index cd5b1ecd61..e1d87b403f 100644 --- a/modules/gui/qt4/components/playlist/playlist_model.hpp +++ b/modules/gui/qt4/components/playlist/playlist_model.hpp @@ -54,6 +54,10 @@ class PLModel : public QAbstractItemModel friend class PLItem; public: + enum { + IsCurrentRole = Qt::UserRole + }; + PLModel( playlist_t *, intf_thread_t *, playlist_item_t *, QObject *parent = 0 ); ~PLModel();