[vlc-commits] Qt: PLModel: don't fetch item on each data role
Francois Cartegnie
git at videolan.org
Tue May 10 19:30:36 CEST 2016
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue May 10 15:59:37 2016 +0200| [5d845f77191e2d2070c879ec1cf34528f41f994a] | committer: Francois Cartegnie
Qt: PLModel: don't fetch item on each data role
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5d845f77191e2d2070c879ec1cf34528f41f994a
---
modules/gui/qt/components/playlist/playlist_model.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/modules/gui/qt/components/playlist/playlist_model.cpp b/modules/gui/qt/components/playlist/playlist_model.cpp
index 1363931..54c112c6 100644
--- a/modules/gui/qt/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt/components/playlist/playlist_model.cpp
@@ -308,9 +308,9 @@ QVariant PLModel::data( const QModelIndex &index, const int role ) const
return QVariant();
}
- PLItem *item = getItem( index );
if( role == Qt::DisplayRole )
{
+ PLItem *item = getItem( index );
int metadata = columnToMeta( index.column() );
if( metadata == COLUMN_END ) return QVariant();
@@ -345,8 +345,11 @@ QVariant PLModel::data( const QModelIndex &index, const int role ) const
switch( columnToMeta(index.column()) )
{
case COLUMN_TITLE:
+ {
+ PLItem *item = getItem( index );
/* Used to segfault here because i_type wasn't always initialized */
return QVariant( icons[item->inputItem()->i_type] );
+ }
case COLUMN_COVER:
/* !warn: changes tree item line height. Otherwise, override
* delegate's sizehint */
More information about the vlc-commits
mailing list