Enabled drag and drop between PlaylistViews.

This commit is contained in:
The Wobbler 2025-01-25 22:41:29 +01:00
parent 31e72c25d3
commit 744d050bac
5 changed files with 66 additions and 6 deletions

View file

@ -0,0 +1,28 @@
#!/usr/bin/python3
from PyQt6.QtGui import QDragEnterEvent
from PyQt6.QtWidgets import QTabWidget, QTabBar
class PlaylistTabs(QTabWidget):
def __init__(self, parent=None):
super().__init__(parent)
self.setTabBar(PlaylistTabBar(self))
self.setMovable(True)
self.setAcceptDrops(True)
class PlaylistTabBar(QTabBar):
def __init__(self, parent=None):
super().__init__(parent)
self.tab_widget = parent
self.setAcceptDrops(True)
def dragEnterEvent(self, event: QDragEnterEvent):
tab = self.tabAt(event.position().toPoint())
self.tab_widget.setCurrentIndex(tab)