1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 22:26:32 +02:00

* Fixed not properly ending drag and drop operation when leaving the sidebar.

This commit is contained in:
Christian Muehlhaeuser
2011-07-19 23:33:35 +02:00
parent ac726faf1b
commit 066aac7e26
2 changed files with 17 additions and 2 deletions

View File

@@ -276,6 +276,7 @@ SourceTreeView::deletePlaylist( const QModelIndex& idxIn )
} }
} }
void void
SourceTreeView::copyPlaylistLink() SourceTreeView::copyPlaylistLink()
{ {
@@ -299,6 +300,7 @@ SourceTreeView::copyPlaylistLink()
} }
} }
void SourceTreeView::addToLocal() void SourceTreeView::addToLocal()
{ {
QModelIndex idx = m_contextMenuIndex; QModelIndex idx = m_contextMenuIndex;
@@ -315,7 +317,8 @@ void SourceTreeView::addToLocal()
// this way we cheaply regenerate the needed controls // this way we cheaply regenerate the needed controls
QString link = GlobalActionManager::instance()->copyPlaylistToClipboard( playlist ); QString link = GlobalActionManager::instance()->copyPlaylistToClipboard( playlist );
dynplaylist_ptr p = GlobalActionManager::instance()->loadDynamicPlaylist( link, type == SourcesModel::Station ); dynplaylist_ptr p = GlobalActionManager::instance()->loadDynamicPlaylist( link, type == SourcesModel::Station );
} else if ( type == SourcesModel::StaticPlaylist ) }
else if ( type == SourcesModel::StaticPlaylist )
{ {
PlaylistItem* item = itemFromIndex< PlaylistItem >( m_contextMenuIndex ); PlaylistItem* item = itemFromIndex< PlaylistItem >( m_contextMenuIndex );
playlist_ptr playlist = item->playlist(); playlist_ptr playlist = item->playlist();
@@ -439,6 +442,16 @@ SourceTreeView::dragEnterEvent( QDragEnterEvent* event )
} }
void
SourceTreeView::dragLeaveEvent( QDragLeaveEvent* event )
{
QTreeView::dragLeaveEvent( event );
m_dragging = false;
setDirtyRegion( m_dropRect );
}
void void
SourceTreeView::dragMoveEvent( QDragMoveEvent* event ) SourceTreeView::dragMoveEvent( QDragMoveEvent* event )
{ {
@@ -486,6 +499,7 @@ SourceTreeView::dropEvent( QDropEvent* event )
m_dragging = false; m_dragging = false;
} }
void void
SourceTreeView::keyPressEvent( QKeyEvent *event ) SourceTreeView::keyPressEvent( QKeyEvent *event )
{ {
@@ -506,6 +520,7 @@ SourceTreeView::keyPressEvent( QKeyEvent *event )
} }
} }
void void
SourceTreeView::paintEvent( QPaintEvent* event ) SourceTreeView::paintEvent( QPaintEvent* event )
{ {

View File

@@ -67,7 +67,7 @@ protected:
virtual void paintEvent( QPaintEvent* event ); virtual void paintEvent( QPaintEvent* event );
virtual void dragEnterEvent( QDragEnterEvent* event ); virtual void dragEnterEvent( QDragEnterEvent* event );
virtual void dragLeaveEvent( QDragLeaveEvent* event ) { Q_UNUSED( event ); m_dragging = false; setDirtyRegion( m_dropRect ); } virtual void dragLeaveEvent( QDragLeaveEvent* event );
virtual void dragMoveEvent( QDragMoveEvent* event ); virtual void dragMoveEvent( QDragMoveEvent* event );
virtual void dropEvent( QDropEvent* event ); virtual void dropEvent( QDropEvent* event );
virtual void keyPressEvent( QKeyEvent* event ); virtual void keyPressEvent( QKeyEvent* event );