diff --git a/wobuzz/ui/playlist_tabs/tab_bar.py b/wobuzz/ui/playlist_tabs/tab_bar.py index f2c87e7..afcfd5f 100644 --- a/wobuzz/ui/playlist_tabs/tab_bar.py +++ b/wobuzz/ui/playlist_tabs/tab_bar.py @@ -26,6 +26,9 @@ class PlaylistTabBar(QTabBar): self.tab_widget.setCurrentIndex(index) def on_click(self, index): + if index == -1: # do nothing if no tab was clicked + return + playlist_view = self.tab_widget.widget(index) playlist = playlist_view.playlist @@ -38,10 +41,16 @@ class PlaylistTabBar(QTabBar): self.app.player.start_playlist(playlist) def contextMenuEvent(self, event: QContextMenuEvent, title=None): + # get title by self.tabAt() if the event is called from PyQt, else its executed from the tab title and getting + # the index by tabAt() wouldn't be possible if title is None: pos = event.pos() index = self.tabAt(pos) + + if index == -1: # when no tab was clicked, do nothing + return + title = self.tabButton(index, QTabBar.ButtonPosition.RightSide) self.context_menu.exec(event.globalPos(), title)