From 3213591de7eab563ce47745ca5741aa7c737407b Mon Sep 17 00:00:00 2001 From: Jakob Leben Date: Fri, 4 Sep 2009 03:06:26 +0200 Subject: [PATCH] qt4: playlist: allow to hide all but the index 0 column In some circumstances QTreeView does not behave properly if the column index 0 can hide/reappear. Precisely, when column 0 is hidden and an item get's subitems, those subitems can not be D&D-ed. If column 0 is then unhidden, trying to D&D the subitems will fail or result in unexpected behaviour. --- modules/gui/qt4/components/playlist/standardpanel.cpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp index c12baa4a55..d7cabd4a12 100644 --- a/modules/gui/qt4/components/playlist/standardpanel.cpp +++ b/modules/gui/qt4/components/playlist/standardpanel.cpp @@ -269,8 +269,10 @@ void StandardPLPanel::popupSelectColumn( QPoint pos ) { QMenu menu; + /* We do not offer the option to hide index 0 column, or + * QTreeView will behave weird */ int i, j; - for( i = 1, j = 0; i < COLUMN_END; i <<= 1, j++ ) + for( i = 1 << 1, j = 1; i < COLUMN_END; i <<= 1, j++ ) { QAction* option = menu.addAction( qfu( psz_column_title( i ) ) ); @@ -284,19 +286,7 @@ void StandardPLPanel::popupSelectColumn( QPoint pos ) void StandardPLPanel::toggleColumnShown( int i ) { - if( view->isColumnHidden( i ) ) - { - view->setColumnHidden( i, false ); - } - else - { - int visible = 0; - int m, c; - for( m = 1, c = 0; m != COLUMN_END && visible < 2; m <<= 1, c++ ) - if( !view->isColumnHidden( c ) ) visible++; - if( visible < 2 ) return; - view->setColumnHidden( i, true ); - } + view->setColumnHidden( i, !view->isColumnHidden( i ) ); } /* Search in the playlist */ -- 2.11.4.GIT