1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 11:20:22 +02:00

* Try to force updates when hovered item in a TrackView changes.

This commit is contained in:
Christian Muehlhaeuser
2011-07-11 02:49:46 +02:00
parent 76af86dc4b
commit 0e04e8970b
3 changed files with 37 additions and 14 deletions

View File

@@ -128,8 +128,6 @@ MusicBrainzPlugin::artistSearchSlot()
} }
QString artist_id = domNodeList.at( 0 ).toElement().attribute( "id" ); 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" ); QString requestString( "http://musicbrainz.org/ws/2/release?status=official&type=album|ep" );
QUrl url( requestString ); QUrl url( requestString );
url.addQueryItem( "artist", artist_id ); url.addQueryItem( "artist", artist_id );

View File

@@ -439,23 +439,20 @@ TrackView::onMenuTriggered( int action )
void void
TrackView::leaveEvent( QEvent* event ) TrackView::updateHoverIndex( const QPoint& pos )
{ {
m_hoveredIndex = QModelIndex(); QModelIndex idx = indexAt( pos );
setCursor( Qt::ArrowCursor );
}
if ( idx != m_hoveredIndex )
void {
TrackView::mouseMoveEvent( QMouseEvent* event ) m_hoveredIndex = idx;
{ repaint();
QModelIndex idx = indexAt( event->pos() ); }
m_hoveredIndex = idx;
if ( idx.column() == TrackModel::Artist || idx.column() == TrackModel::Album ) if ( idx.column() == TrackModel::Artist || idx.column() == TrackModel::Album )
{ {
if ( event->pos().x() > header()->sectionViewportPosition( idx.column() ) + header()->sectionSize( idx.column() ) - 16 && if ( pos.x() > header()->sectionViewportPosition( idx.column() ) + header()->sectionSize( idx.column() ) - 16 &&
event->pos().x() < header()->sectionViewportPosition( idx.column() ) + header()->sectionSize( idx.column() ) ) pos.x() < header()->sectionViewportPosition( idx.column() ) + header()->sectionSize( idx.column() ) )
{ {
setCursor( Qt::PointingHandCursor ); setCursor( Qt::PointingHandCursor );
return; 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 void
TrackView::mousePressEvent( QMouseEvent* event ) TrackView::mousePressEvent( QMouseEvent* event )
{ {
QTreeView::mousePressEvent( event );
QModelIndex idx = indexAt( event->pos() ); QModelIndex idx = indexAt( event->pos() );
if ( event->pos().x() > header()->sectionViewportPosition( idx.column() ) + header()->sectionSize( idx.column() ) - 16 && if ( event->pos().x() > header()->sectionViewportPosition( idx.column() ) + header()->sectionSize( idx.column() ) - 16 &&

View File

@@ -75,6 +75,7 @@ protected:
virtual void dragMoveEvent( QDragMoveEvent* event ); virtual void dragMoveEvent( QDragMoveEvent* event );
virtual void dropEvent( QDropEvent* event ); virtual void dropEvent( QDropEvent* event );
void wheelEvent( QWheelEvent* event );
void mouseMoveEvent( QMouseEvent* event ); void mouseMoveEvent( QMouseEvent* event );
void mousePressEvent( QMouseEvent* event ); void mousePressEvent( QMouseEvent* event );
void leaveEvent( QEvent* event ); void leaveEvent( QEvent* event );
@@ -88,6 +89,8 @@ private slots:
void onCustomContextMenu( const QPoint& pos ); void onCustomContextMenu( const QPoint& pos );
private: private:
void updateHoverIndex( const QPoint& pos );
QString m_guid; QString m_guid;
TrackModel* m_model; TrackModel* m_model;
TrackProxyModel* m_proxyModel; TrackProxyModel* m_proxyModel;