[vlc-commits] commit: qt4: keep selected popup item visible when sorting (Ilkka Ollakka )

git at videolan.org git at videolan.org
Sun Mar 28 18:01:09 CEST 2010


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Sun Mar 28 17:41:59 2010 +0300| [d6c7145335f8651b6d43783c2e17348944492860] | committer: Ilkka Ollakka 

qt4: keep selected popup item visible when sorting

Still could be better to leave selected item as selected after sorting.

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

 .../gui/qt4/components/playlist/playlist_model.cpp |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index 0c4f57f..d1a7ac4 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -864,6 +864,15 @@ void PLModel::sort( int i_root_id, int column, Qt::SortOrder order )
         endInsertRows( );
     }
     PL_UNLOCK;
+    /* if we have popup item, try to make sure that you keep that item visible */
+    if( i_popup_item > -1 )
+    {
+        PLItem *popupitem = findById( rootItem, i_popup_item );
+        if( popupitem ) emit currentChanged( index( popupitem, 0 ) );
+        /* reset i_popup_item as we don't show it as selected anymore anyway */
+        i_popup_item = -1;
+    }
+    else if( currentIndex().isValid() ) emit currentChanged( currentIndex() );
 }
 
 void PLModel::search( const QString& search_text, const QModelIndex & idx, bool b_recursive )



More information about the vlc-commits mailing list