Added playlist tab title index synchronisation to fix some bugs.
This commit is contained in:
parent
5f20c6e5b0
commit
9ee4184c84
2 changed files with 22 additions and 4 deletions
|
@ -20,12 +20,19 @@ class PlaylistTabs(QTabWidget):
|
|||
self.setMovable(True)
|
||||
self.setAcceptDrops(True)
|
||||
|
||||
def addTab(self, playlist_view, label):
|
||||
super().addTab(playlist_view, None)
|
||||
|
||||
index = self.tab_bar.count() - 1
|
||||
def addTab(self, playlist_view, label) -> int:
|
||||
index = super().addTab(playlist_view, None)
|
||||
|
||||
title = TabTitle(self.app, label, self.tab_bar, index, playlist_view)
|
||||
|
||||
self.tab_bar.setTabButton(index, QTabBar.ButtonPosition.RightSide, title)
|
||||
|
||||
return index
|
||||
|
||||
def tabRemoved(self, index):
|
||||
# Update indexes because when a playlist is replaced, (and the old playlist widget is deleted by deleteLater())
|
||||
# the old playlist_widget is actually deleted later than the new one is created.
|
||||
# Because of this, the new playlist tab gets immediately moved one to the left and we have to update the
|
||||
# indexes.
|
||||
self.tab_bar.update_title_indexes(index)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue