From 7b878f5ab0aa91255e1cd6a834852c9a9b23055a Mon Sep 17 00:00:00 2001 From: Ilkka Ollakka Date: Mon, 16 Apr 2012 15:34:27 +0300 Subject: [PATCH] Qt4: when in tree-like playlist, scroll previous rootitem to be visible This hopefully helps on scrollin bigger playlists as view is not always back on top. --- .../gui/qt4/components/playlist/standardpanel.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp index 29dd9e181f..badb68c750 100644 --- a/modules/gui/qt4/components/playlist/standardpanel.cpp +++ b/modules/gui/qt4/components/playlist/standardpanel.cpp @@ -203,8 +203,19 @@ void StandardPLPanel::browseInto( const QModelIndex &index ) { if( currentView == iconView || currentView == listView || currentView == picFlowView ) { - currentRootIndexId = model->itemId( index ); + currentView->setRootIndex( index ); + + /* When going toward root in LocationBar, scroll to the item + that was previously as root */ + QModelIndex newIndex = model->index(currentRootIndexId,0); + while( newIndex.isValid() && (newIndex.parent() != index) ) + newIndex = newIndex.parent(); + if( newIndex.isValid() ) + currentView->scrollTo( newIndex ); + + /* Store new rootindexid*/ + currentRootIndexId = model->itemId( index ); } emit viewChanged( index ); -- 2.39.2