Commit 221b1068 authored by Abdel-Rahman Abdel-Rahman's avatar Abdel-Rahman Abdel-Rahman
Browse files

Switch to the playlist when dragging tracks to it.

This allows the user to drag and drop tracks at an arbitrary position
within the playlist.
parent f6acade5
...@@ -543,6 +543,16 @@ void PlaylistBox::setSingleItem(QTreeWidgetItem *item) ...@@ -543,6 +543,16 @@ void PlaylistBox::setSingleItem(QTreeWidgetItem *item)
setSelectionMode(QAbstractItemView::ExtendedSelection); setSelectionMode(QAbstractItemView::ExtendedSelection);
} }
void PlaylistBox::dragMoveEvent(QDragMoveEvent* event)
{
QTreeWidget::dragMoveEvent(event);
QTreeWidgetItem* hovered_item = itemAt(event->pos());
if(hovered_item)
raise(static_cast<Item *>(hovered_item)->playlist());
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// PlaylistBox private slots // PlaylistBox private slots
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
......
...@@ -109,6 +109,7 @@ private: ...@@ -109,6 +109,7 @@ private:
void setupUpcomingPlaylist(); void setupUpcomingPlaylist();
int viewModeIndex() const { return m_viewModeIndex; } int viewModeIndex() const { return m_viewModeIndex; }
ViewMode *viewMode() const { return m_viewModes[m_viewModeIndex]; } ViewMode *viewMode() const { return m_viewModes[m_viewModeIndex]; }
void dragMoveEvent(QDragMoveEvent *event) override;
private slots: private slots:
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment