[vlc-devel] commit: Qt: iconView delegate: encode PLModel::IsCurrent(QModelIndex) into cache key (Jakob Leben )
git version control
git at videolan.org
Thu Jan 28 20:10:33 CET 2010
vlc | branch: master | Jakob Leben <jleben at videolan.org> | Thu Jan 28 20:08:50 2010 +0100| [20431e3be581bf2a513f223bc98c93619bb623c9] | committer: Jakob Leben
Qt: iconView delegate: encode PLModel::IsCurrent(QModelIndex) into cache key
This way item is redrawn when current item changes.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=20431e3be581bf2a513f223bc98c93619bb623c9
---
modules/gui/qt4/components/playlist/icon_view.cpp | 3 ++-
.../gui/qt4/components/playlist/playlist_model.cpp | 1 +
.../gui/qt4/components/playlist/playlist_model.hpp | 4 ++++
3 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/modules/gui/qt4/components/playlist/icon_view.cpp b/modules/gui/qt4/components/playlist/icon_view.cpp
index 856cbd6..7e63ebe 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 4552918..f9c8762 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 cd5b1ec..e1d87b4 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();
More information about the vlc-devel
mailing list