From 20431e3be581bf2a513f223bc98c93619bb623c9 Mon Sep 17 00:00:00 2001 From: Jakob Leben Date: Thu, 28 Jan 2010 20:08:50 +0100 Subject: [PATCH] Qt: iconView delegate: encode PLModel::IsCurrent(QModelIndex) into cache key This way item is redrawn when current item changes. --- modules/gui/qt4/components/playlist/icon_view.cpp | 3 ++- modules/gui/qt4/components/playlist/playlist_model.cpp | 1 + modules/gui/qt4/components/playlist/playlist_model.hpp | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) 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(); -- 2.39.2