mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-25 10:19:41 +01:00
* Try to force updates when hovered item in a TrackView changes.
This commit is contained in:
parent
76af86dc4b
commit
0e04e8970b
@ -128,8 +128,6 @@ MusicBrainzPlugin::artistSearchSlot()
|
||||
}
|
||||
|
||||
QString artist_id = domNodeList.at( 0 ).toElement().attribute( "id" );
|
||||
qDebug() << Q_FUNC_INFO << "FOOBAR:" << artist_id;
|
||||
|
||||
QString requestString( "http://musicbrainz.org/ws/2/release?status=official&type=album|ep" );
|
||||
QUrl url( requestString );
|
||||
url.addQueryItem( "artist", artist_id );
|
||||
|
@ -439,23 +439,20 @@ TrackView::onMenuTriggered( int action )
|
||||
|
||||
|
||||
void
|
||||
TrackView::leaveEvent( QEvent* event )
|
||||
TrackView::updateHoverIndex( const QPoint& pos )
|
||||
{
|
||||
m_hoveredIndex = QModelIndex();
|
||||
setCursor( Qt::ArrowCursor );
|
||||
}
|
||||
QModelIndex idx = indexAt( pos );
|
||||
|
||||
|
||||
void
|
||||
TrackView::mouseMoveEvent( QMouseEvent* event )
|
||||
{
|
||||
QModelIndex idx = indexAt( event->pos() );
|
||||
m_hoveredIndex = idx;
|
||||
if ( idx != m_hoveredIndex )
|
||||
{
|
||||
m_hoveredIndex = idx;
|
||||
repaint();
|
||||
}
|
||||
|
||||
if ( idx.column() == TrackModel::Artist || idx.column() == TrackModel::Album )
|
||||
{
|
||||
if ( event->pos().x() > header()->sectionViewportPosition( idx.column() ) + header()->sectionSize( idx.column() ) - 16 &&
|
||||
event->pos().x() < header()->sectionViewportPosition( idx.column() ) + header()->sectionSize( idx.column() ) )
|
||||
if ( pos.x() > header()->sectionViewportPosition( idx.column() ) + header()->sectionSize( idx.column() ) - 16 &&
|
||||
pos.x() < header()->sectionViewportPosition( idx.column() ) + header()->sectionSize( idx.column() ) )
|
||||
{
|
||||
setCursor( Qt::PointingHandCursor );
|
||||
return;
|
||||
@ -466,9 +463,34 @@ TrackView::mouseMoveEvent( QMouseEvent* event )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TrackView::wheelEvent( QWheelEvent* event )
|
||||
{
|
||||
QTreeView::wheelEvent( event );
|
||||
updateHoverIndex( event->pos() );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TrackView::leaveEvent( QEvent* event )
|
||||
{
|
||||
QTreeView::leaveEvent( event );
|
||||
updateHoverIndex( QPoint( -1, -1 ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TrackView::mouseMoveEvent( QMouseEvent* event )
|
||||
{
|
||||
QTreeView::mouseMoveEvent( event );
|
||||
updateHoverIndex( event->pos() );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TrackView::mousePressEvent( QMouseEvent* event )
|
||||
{
|
||||
QTreeView::mousePressEvent( event );
|
||||
QModelIndex idx = indexAt( event->pos() );
|
||||
|
||||
if ( event->pos().x() > header()->sectionViewportPosition( idx.column() ) + header()->sectionSize( idx.column() ) - 16 &&
|
||||
|
@ -75,6 +75,7 @@ protected:
|
||||
virtual void dragMoveEvent( QDragMoveEvent* event );
|
||||
virtual void dropEvent( QDropEvent* event );
|
||||
|
||||
void wheelEvent( QWheelEvent* event );
|
||||
void mouseMoveEvent( QMouseEvent* event );
|
||||
void mousePressEvent( QMouseEvent* event );
|
||||
void leaveEvent( QEvent* event );
|
||||
@ -88,6 +89,8 @@ private slots:
|
||||
void onCustomContextMenu( const QPoint& pos );
|
||||
|
||||
private:
|
||||
void updateHoverIndex( const QPoint& pos );
|
||||
|
||||
QString m_guid;
|
||||
TrackModel* m_model;
|
||||
TrackProxyModel* m_proxyModel;
|
||||
|
Loading…
x
Reference in New Issue
Block a user