Added playlist tab title index synchronisation to fix some bugs.

This commit is contained in:
The Wobbler 2025-03-03 16:13:37 +01:00
parent 5f20c6e5b0
commit 9ee4184c84
2 changed files with 22 additions and 4 deletions

View file

@ -19,6 +19,7 @@ class PlaylistTabBar(QTabBar):
self.tabBarClicked.connect(self.on_click)
self.tabBarDoubleClicked.connect(self.on_doubleclick)
self.tabMoved.connect(self.on_tab_move)
def dragEnterEvent(self, event: QDragEnterEvent):
index = self.tabAt(event.position().toPoint())
@ -62,3 +63,13 @@ class PlaylistTabBar(QTabBar):
self.context_menu.exec(event.globalPos(), title)
def on_tab_move(self, i_from, i_to):
title = self.tabButton(i_to, QTabBar.ButtonPosition.RightSide)
# update the index
title.index = i_to
def update_title_indexes(self, after: int):
for i in range(after, self.count()):
title = self.tabButton(i, QTabBar.ButtonPosition.RightSide)
title.index = i