Enabled drag and drop between PlaylistViews.
This commit is contained in:
parent
31e72c25d3
commit
744d050bac
5 changed files with 66 additions and 6 deletions
28
wobuzz/ui/playlist_tabs.py
Normal file
28
wobuzz/ui/playlist_tabs.py
Normal 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)
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue