From 066aac7e26e5060aee59797661dbabc62e8d341f Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Tue, 19 Jul 2011 23:33:35 +0200 Subject: [PATCH] * Fixed not properly ending drag and drop operation when leaving the sidebar. --- src/sourcetree/sourcetreeview.cpp | 17 ++++++++++++++++- src/sourcetree/sourcetreeview.h | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/sourcetree/sourcetreeview.cpp b/src/sourcetree/sourcetreeview.cpp index 8043624cd..e1f2b8fc0 100644 --- a/src/sourcetree/sourcetreeview.cpp +++ b/src/sourcetree/sourcetreeview.cpp @@ -276,6 +276,7 @@ SourceTreeView::deletePlaylist( const QModelIndex& idxIn ) } } + void SourceTreeView::copyPlaylistLink() { @@ -299,6 +300,7 @@ SourceTreeView::copyPlaylistLink() } } + void SourceTreeView::addToLocal() { QModelIndex idx = m_contextMenuIndex; @@ -315,7 +317,8 @@ void SourceTreeView::addToLocal() // this way we cheaply regenerate the needed controls QString link = GlobalActionManager::instance()->copyPlaylistToClipboard( playlist ); 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 ); 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 SourceTreeView::dragMoveEvent( QDragMoveEvent* event ) { @@ -486,6 +499,7 @@ SourceTreeView::dropEvent( QDropEvent* event ) m_dragging = false; } + void SourceTreeView::keyPressEvent( QKeyEvent *event ) { @@ -506,6 +520,7 @@ SourceTreeView::keyPressEvent( QKeyEvent *event ) } } + void SourceTreeView::paintEvent( QPaintEvent* event ) { diff --git a/src/sourcetree/sourcetreeview.h b/src/sourcetree/sourcetreeview.h index 0824ae3c7..a33b3f7c5 100644 --- a/src/sourcetree/sourcetreeview.h +++ b/src/sourcetree/sourcetreeview.h @@ -67,7 +67,7 @@ protected: virtual void paintEvent( QPaintEvent* 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 dropEvent( QDropEvent* event ); virtual void keyPressEvent( QKeyEvent* event );