mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-03 20:57:52 +02: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:
@@ -162,6 +162,7 @@ TrackView::setProxyModel( PlayableProxyModel* model )
|
|||||||
disconnect( m_proxyModel, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SLOT( verifySize() ) );
|
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( expandRequest( QPersistentModelIndex ) ), this, SLOT( expand( QPersistentModelIndex ) ) );
|
||||||
disconnect( m_proxyModel, SIGNAL( selectRequest( QPersistentModelIndex ) ), this, SLOT( select( 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;
|
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( rowsRemoved( QModelIndex, int, int ) ), SLOT( verifySize() ) );
|
||||||
connect( m_proxyModel, SIGNAL( expandRequest( QPersistentModelIndex ) ), SLOT( expand( QPersistentModelIndex ) ) );
|
connect( m_proxyModel, SIGNAL( expandRequest( QPersistentModelIndex ) ), SLOT( expand( QPersistentModelIndex ) ) );
|
||||||
connect( m_proxyModel, SIGNAL( selectRequest( QPersistentModelIndex ) ), SLOT( select( 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 );
|
m_delegate = new PlaylistItemDelegate( this, m_proxyModel );
|
||||||
QTreeView::setItemDelegate( m_delegate );
|
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
|
void
|
||||||
TrackView::onViewChanged()
|
TrackView::onViewChanged()
|
||||||
{
|
{
|
||||||
|
@@ -130,6 +130,7 @@ private slots:
|
|||||||
void onFilterChanged( const QString& filter );
|
void onFilterChanged( const QString& filter );
|
||||||
void onModelFilling();
|
void onModelFilling();
|
||||||
void onModelEmptyCheck();
|
void onModelEmptyCheck();
|
||||||
|
void onCurrentIndexChanged( const QModelIndex& newIndex, const QModelIndex& oldIndex );
|
||||||
|
|
||||||
void onCustomContextMenu( const QPoint& pos );
|
void onCustomContextMenu( const QPoint& pos );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user