[vlc-devel] commit: qt4: playlist: allow to hide all but the index 0 column ( Jakob Leben )
git version control
git at videolan.org
Sat Sep 5 17:50:44 CEST 2009
vlc | branch: master | Jakob Leben <jleben at videolan.org> | Fri Sep 4 03:06:26 2009 +0200| [3213591de7eab563ce47745ca5741aa7c737407b] | committer: Jakob Leben
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.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3213591de7eab563ce47745ca5741aa7c737407b
---
.../gui/qt4/components/playlist/standardpanel.cpp | 18 ++++--------------
1 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp
index c12baa4..d7cabd4 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 */
More information about the vlc-devel
mailing list