]> git.sesse.net Git - vlc/commitdiff
QT4: set sorting-connections by hand
authorIlkka Ollakka <ileoo@videolan.org>
Fri, 31 Jul 2009 10:36:58 +0000 (13:36 +0300)
committerIlkka Ollakka <ileoo@videolan.org>
Fri, 31 Jul 2009 10:43:09 +0000 (13:43 +0300)
Thisway playlist don't run sort when created (in case of you start vlc,
and don't set playlist visible then adding stuff. When you open playlist
it would sort the stuff).

Also remove showing sort-indicator incorrectly on start (don't show
it at all before user clicks to sort).

modules/gui/qt4/components/playlist/standardpanel.cpp

index 51cb0f9f15b7c95170e0359901de402cc51f12b6..1741d459880dffb8fbc81924eda27a6da570dc07 100644 (file)
@@ -61,8 +61,8 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
 
     /* Create and configure the QTreeView */
     view = new QVLCTreeView;
-    view->header()->setSortIndicator( 0 , Qt::AscendingOrder );
-    view->setSortingEnabled( true );
+
+
     view->setModel( model );
     view->setIconSize( QSize( 20, 20 ) );
     view->setAlternatingRowColors( true );
@@ -86,11 +86,15 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
         view->header()->resizeSection( 0, 200 );
         view->header()->resizeSection( 1, 80 );
     }
-    view->header()->setSortIndicatorShown( true );
     view->header()->setClickable( true );
     view->header()->setContextMenuPolicy( Qt::CustomContextMenu );
     getSettings()->endGroup();
 
+    /* Set sorting enable by hand, so it doesn't run sort on start */
+    view->header()->setSortIndicator( -1, Qt::AscendingOrder );
+    view->header()->setSortIndicatorShown( true );
+    CONNECT( view->header(), sortIndicatorChanged( int, Qt::SortOrder ),
+             view, sortByColumn( int ) );
     /* Connections for the TreeView */
     CONNECT( view, activated( const QModelIndex& ) ,
              model,activateItem( const QModelIndex& ) );