[vlc-commits] Qt: correctly display the right treeView columns
Jean-Baptiste Kempf
git at videolan.org
Thu Nov 17 23:16:28 CET 2011
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Thu Nov 17 23:15:56 2011 +0100| [2c2eef52969fa6c2e5cb21dcd59a75e5042a818f] | committer: Jean-Baptiste Kempf
Qt: correctly display the right treeView columns
Close #2082
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2c2eef52969fa6c2e5cb21dcd59a75e5042a818f
---
.../gui/qt4/components/playlist/standardpanel.cpp | 43 +++++++++++---------
1 files changed, 24 insertions(+), 19 deletions(-)
diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp
index 9ae14e9..85258c1 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.cpp
@@ -306,25 +306,6 @@ void StandardPLPanel::createTreeView()
/* setModel after setSortingEnabled(true), or the model will sort immediately! */
- getSettings()->beginGroup("Playlist");
-
- if( getSettings()->contains( "headerStateV2" ) )
- {
- treeView->header()->restoreState(
- getSettings()->value( "headerStateV2" ).toByteArray() );
- }
- else
- {
- for( int m = 1, c = 0; m != COLUMN_END; m <<= 1, c++ )
- {
- treeView->setColumnHidden( c, !( m & COLUMN_DEFAULT ) );
- if( m == COLUMN_TITLE ) treeView->header()->resizeSection( c, 200 );
- else if( m == COLUMN_DURATION ) treeView->header()->resizeSection( c, 80 );
- }
- }
-
- getSettings()->endGroup();
-
/* Connections for the TreeView */
CONNECT( treeView, activated( const QModelIndex& ),
this, activate( const QModelIndex& ) );
@@ -361,6 +342,7 @@ void StandardPLPanel::changeModel( bool b_ml )
void StandardPLPanel::showView( int i_view )
{
+ bool b_treeViewCreated = false;
switch( i_view )
{
@@ -389,7 +371,10 @@ void StandardPLPanel::showView( int i_view )
case TREE_VIEW:
{
if( treeView == NULL )
+ {
createTreeView();
+ b_treeViewCreated = true;
+ }
currentView = treeView;
break;
}
@@ -397,6 +382,26 @@ void StandardPLPanel::showView( int i_view )
changeModel( false );
+ /* Restoring the header Columns must come after changeModel */
+ if( b_treeViewCreated )
+ {
+ assert( treeView );
+ if( getSettings()->contains( "Playlist/headerStateV2" ) )
+ {
+ treeView->header()->restoreState(getSettings()
+ ->value( "Playlist/headerStateV2" ).toByteArray() );
+ }
+ else
+ {
+ for( int m = 1, c = 0; m != COLUMN_END; m <<= 1, c++ )
+ {
+ treeView->setColumnHidden( c, !( m & COLUMN_DEFAULT ) );
+ if( m == COLUMN_TITLE ) treeView->header()->resizeSection( c, 200 );
+ else if( m == COLUMN_DURATION ) treeView->header()->resizeSection( c, 80 );
+ }
+ }
+ }
+
viewStack->setCurrentWidget( currentView );
browseInto();
gotoPlayingItem();
More information about the vlc-commits
mailing list