Made the playlist tabs look prettier by making the tab title editor non-static.

This commit is contained in:
The Wobbler 2025-03-03 17:18:30 +01:00
parent 0101cf174c
commit 7ff1ad7a02
7 changed files with 46 additions and 84 deletions

View file

@ -1,9 +1,8 @@
#!/usr/bin/python3
from PyQt6.QtWidgets import QTabWidget, QTabBar
from PyQt6.QtWidgets import QTabWidget
from .tab_bar import PlaylistTabBar
from .tab_title import TabTitle
class PlaylistTabs(QTabWidget):
@ -19,20 +18,3 @@ class PlaylistTabs(QTabWidget):
self.setMovable(True)
self.setAcceptDrops(True)
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)