1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 07:49:42 +01:00

* Move along item selection with song change, if the previously playing track is the single selected item in a TrackView.

This commit is contained in:
Christian Muehlhaeuser 2014-09-24 05:59:17 +02:00
parent 8142ffba4c
commit ad5ccc8f4b
2 changed files with 14 additions and 0 deletions

View File

@ -162,6 +162,7 @@ TrackView::setProxyModel( PlayableProxyModel* model )
disconnect( m_proxyModel, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SLOT( verifySize() ) );
disconnect( m_proxyModel, SIGNAL( expandRequest( QPersistentModelIndex ) ), this, SLOT( expand( QPersistentModelIndex ) ) );
disconnect( m_proxyModel, SIGNAL( selectRequest( QPersistentModelIndex ) ), this, SLOT( select( QPersistentModelIndex ) ) );
disconnect( m_proxyModel, SIGNAL( currentIndexChanged( QModelIndex, QModelIndex ) ), this, SLOT( onCurrentIndexChanged( QModelIndex, QModelIndex ) ) );
}
m_proxyModel = model;
@ -174,6 +175,7 @@ TrackView::setProxyModel( PlayableProxyModel* model )
connect( m_proxyModel, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), SLOT( verifySize() ) );
connect( m_proxyModel, SIGNAL( expandRequest( QPersistentModelIndex ) ), SLOT( expand( QPersistentModelIndex ) ) );
connect( m_proxyModel, SIGNAL( selectRequest( QPersistentModelIndex ) ), SLOT( select( QPersistentModelIndex ) ) );
connect( m_proxyModel, SIGNAL( currentIndexChanged( QModelIndex, QModelIndex ) ), SLOT( onCurrentIndexChanged( QModelIndex, QModelIndex ) ) );
m_delegate = new PlaylistItemDelegate( this, m_proxyModel );
QTreeView::setItemDelegate( m_delegate );
@ -276,6 +278,17 @@ TrackView::onModelEmptyCheck()
}
void
TrackView::onCurrentIndexChanged( const QModelIndex& newIndex, const QModelIndex& oldIndex )
{
if ( selectedIndexes().count() == 1 && currentIndex() == oldIndex )
{
selectionModel()->select( newIndex, QItemSelectionModel::SelectCurrent );
currentChanged( newIndex, oldIndex );
}
}
void
TrackView::onViewChanged()
{

View File

@ -130,6 +130,7 @@ private slots:
void onFilterChanged( const QString& filter );
void onModelFilling();
void onModelEmptyCheck();
void onCurrentIndexChanged( const QModelIndex& newIndex, const QModelIndex& oldIndex );
void onCustomContextMenu( const QPoint& pos );