[vlc-devel] commit: Qt: playlist (Fix #3248) Set model after sorting enabled to prevent sorting immediately ( Jakob Leben )

git version control git at videolan.org
Thu Jan 28 09:00:33 CET 2010


vlc | branch: master | Jakob Leben <jleben at videolan.org> | Thu Jan 28 08:36:00 2010 +0100| [cdd26d2f59ab41c5e6cd6bcbb124f3582e376abb] | committer: Jakob Leben 

Qt: playlist (Fix #3248) Set model after sorting enabled to prevent sorting immediately

And add a debug msg when sorting happens.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cdd26d2f59ab41c5e6cd6bcbb124f3582e376abb
---

 .../gui/qt4/components/playlist/playlist_model.cpp |    2 ++
 .../gui/qt4/components/playlist/standardpanel.cpp  |    4 +++-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index a9bef58..4552918 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -815,6 +815,8 @@ void PLModel::sort( int column, Qt::SortOrder order )
 
 void PLModel::sort( int i_root_id, int column, Qt::SortOrder order )
 {
+    msg_Dbg( p_intf, "Sorting by column %i, order %i", column, order );
+
     int meta = columnToMeta( column );
     if( meta == COLUMN_END ) return;
 
diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp
index f9bb59f..dbb19cb 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.cpp
@@ -295,7 +295,6 @@ void StandardPLPanel::createTreeView()
 {
     /* Create and configure the QTreeView */
     treeView = new QTreeView;
-    treeView->setModel( model );
 
     treeView->setIconSize( QSize( 20, 20 ) );
     treeView->setAlternatingRowColors( true );
@@ -314,6 +313,9 @@ void StandardPLPanel::createTreeView()
     treeView->setDropIndicatorShown( true );
     treeView->setContextMenuPolicy( Qt::CustomContextMenu );
 
+    /* setModel after setSortingEnabled(true), or the model will sort immediately! */
+    treeView->setModel( model );
+
     if( getSettings()->contains( "headerStateV2" ) )
     {
         treeView->header()->restoreState(




More information about the vlc-devel mailing list