]> git.sesse.net Git - vlc/commitdiff
Qt iconView: initial attempt at item browsing/playing
authorJakob Leben <jleben@videolan.org>
Mon, 25 Jan 2010 15:49:55 +0000 (16:49 +0100)
committerJakob Leben <jleben@videolan.org>
Mon, 25 Jan 2010 15:51:34 +0000 (16:51 +0100)
modules/gui/qt4/components/playlist/icon_view.cpp
modules/gui/qt4/components/playlist/icon_view.hpp

index b55aee141222ec3010f6a6ee2ae9dd36f3d14abb..b3101e9a6f292708a59712370d632df4af0c62ef 100644 (file)
@@ -103,4 +103,18 @@ PlIconView::PlIconView( PLModel *model, QWidget *parent ) : QListView( parent )
 
     PlListViewItemDelegate *pl = new PlListViewItemDelegate();
     setItemDelegate( pl );
+
+    CONNECT( this, activated( const QModelIndex & ), this, activate( const QModelIndex & ) );
+}
+
+void PlIconView::activate( const QModelIndex & index )
+{
+    if( model()->hasChildren( index ) )
+        setRootIndex( index );
+    else
+    {
+        PLModel *plModel = qobject_cast<PLModel*>( model() );
+        if( !plModel ) return;
+        plModel->activateItem( index );
+    }
 }
index 1d733848c187afd0ffb7e391541087775eb55752..9819eb08fa34507862557a9464beb9b2dac60040 100644 (file)
@@ -47,6 +47,8 @@ class PlIconView : public QListView
 
 public:
     PlIconView( PLModel *model, QWidget *parent = 0 );
+public slots:
+    void activate( const QModelIndex & index );
 };
 
 #endif