]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/playlist/playlist_model.cpp
Qt4: highlight nodepath to current item on icon_view
[vlc] / modules / gui / qt4 / components / playlist / playlist_model.cpp
index 756ee00d0f86eba2b02282b15dd5eb491249fbdc..2c1fb7644e2f206f7bcf4b361d3648fc2c773f36 100644 (file)
@@ -378,9 +378,25 @@ QVariant PLModel::data( const QModelIndex &index, int role ) const
         PL_UNLOCK;
         return isLeaf;
     }
+    else if( role == IsCurrentsParentNodeRole )
+    {
+        return QVariant( isParent( index, current_index ) );
+    }
     return QVariant();
 }
 
+/* Seek from current index toward the top and see if index is one of parent nodes */
+bool PLModel::isParent( const QModelIndex &index, const QModelIndex &current ) const
+{
+    if( index == current )
+        return true;
+
+    if( !current.parent().isValid() )
+        return false;
+
+    return isParent( index, current.parent() );
+}
+
 bool PLModel::isCurrent( const QModelIndex &index ) const
 {
     return index == current_index;