forked from Wobbl/Wobuzz
Got the context menu and focusing working.
This commit is contained in:
parent
60dee10d1a
commit
b2aa7ffd8c
4 changed files with 51 additions and 4 deletions
|
@ -1,8 +1,10 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
from PyQt6.QtGui import QDragEnterEvent
|
||||
from PyQt6.QtGui import QDragEnterEvent, QContextMenuEvent
|
||||
from PyQt6.QtWidgets import QTabBar
|
||||
|
||||
from .tab_context_menu import PlaylistContextMenu
|
||||
|
||||
|
||||
class PlaylistTabBar(QTabBar):
|
||||
def __init__(self, parent=None):
|
||||
|
@ -11,6 +13,8 @@ class PlaylistTabBar(QTabBar):
|
|||
self.tab_widget = parent
|
||||
self.app = parent.library.app
|
||||
|
||||
self.context_menu = PlaylistContextMenu(self)
|
||||
|
||||
self.setAcceptDrops(True)
|
||||
|
||||
self.tabBarClicked.connect(self.on_click)
|
||||
|
@ -33,3 +37,13 @@ class PlaylistTabBar(QTabBar):
|
|||
|
||||
self.app.player.start_playlist(playlist)
|
||||
|
||||
def contextMenuEvent(self, event: QContextMenuEvent, title=None):
|
||||
if title is None:
|
||||
pos = event.pos()
|
||||
|
||||
index = self.tabAt(pos)
|
||||
title = self.tabButton(index, QTabBar.ButtonPosition.RightSide)
|
||||
print(index)
|
||||
|
||||
self.context_menu.exec(event.globalPos(), title)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue