1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-09 15:47:38 +02:00

* Fixed PlaylistItemDelegate swallowing mouse events, which prevented TrackView from triggering D&D operations.

This commit is contained in:
Christian Muehlhaeuser
2013-04-26 06:06:44 +02:00
parent 9a1ed86d62
commit 2b6081f4c7

View File

@@ -287,14 +287,14 @@ PlaylistItemDelegate::paintDetailed( QPainter* painter, const QStyleOptionViewIt
bool bool
PlaylistItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index ) PlaylistItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index )
{ {
Q_UNUSED( model ); QStyledItemDelegate::editorEvent( event, model, option, index );
Q_UNUSED( option );
if ( event->type() != QEvent::MouseButtonRelease && if ( event->type() != QEvent::MouseButtonRelease &&
event->type() != QEvent::MouseMove && event->type() != QEvent::MouseMove &&
event->type() != QEvent::MouseButtonPress &&
event->type() != QEvent::Leave ) event->type() != QEvent::Leave )
{
return false; return false;
}
bool hoveringInfo = false; bool hoveringInfo = false;
if ( m_infoButtonRects.contains( index ) ) if ( m_infoButtonRects.contains( index ) )
@@ -319,8 +319,8 @@ PlaylistItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, con
emit updateIndex( m_hoveringOver ); emit updateIndex( m_hoveringOver );
} }
event->accept(); // We return false here so the view can still decide to process/trigger things like D&D events
return true; return false;
} }
// reset mouse cursor. we switch to a pointing hand cursor when hovering an info button // reset mouse cursor. we switch to a pointing hand cursor when hovering an info button
@@ -369,12 +369,6 @@ PlaylistItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, con
event->accept(); event->accept();
return true; return true;
} }
else if ( event->type() == QEvent::MouseButtonPress )
{
// Stop the whole item from having a down click action as we just want the info button to be clicked
event->accept();
return true;
}
} }
return false; return false;