Best-efforts resize row heights on open

This commit is contained in:
Keith Edmunds 2023-12-16 12:37:41 +00:00
parent 74bdbe2975
commit 2432039b72
2 changed files with 9 additions and 3 deletions

View File

@ -593,7 +593,6 @@ class Window(QMainWindow, Ui_MainWindow):
playlist_id=playlist.id, playlist_id=playlist.id,
) )
idx = self.tabPlaylist.addTab(playlist_tab, playlist.name) idx = self.tabPlaylist.addTab(playlist_tab, playlist.name)
self.tabPlaylist.setCurrentIndex(idx)
return idx return idx
@ -1009,9 +1008,11 @@ class Window(QMainWindow, Ui_MainWindow):
dlg.exec() dlg.exec()
playlist = dlg.playlist playlist = dlg.playlist
if playlist: if playlist:
self.create_playlist_tab(playlist) idx = self.create_playlist_tab(playlist)
playlist.mark_open() playlist.mark_open()
self.tabPlaylist.setCurrentIndex(idx)
def paste_rows(self) -> None: def paste_rows(self) -> None:
""" """
Paste earlier cut rows. Paste earlier cut rows.

View File

@ -204,7 +204,12 @@ class PlaylistTab(QTableView):
if isinstance(h_header, QHeaderView): if isinstance(h_header, QHeaderView):
h_header.sectionResized.connect(self._column_resize) h_header.sectionResized.connect(self._column_resize)
h_header.setStretchLastSection(True) h_header.setStretchLastSection(True)
QTimer.singleShot(0, lambda: self.resizeRowsToContents()) # Setting ResizeToContents causes screen flash on load
# v_header = self.verticalHeader()
# if v_header:
# print("HEADER")
# v_header.setSectionResizeMode(QHeaderView.ResizeMode.ResizeToContents)
QTimer.singleShot(300, self.resizeRowsToContents)
# ########## Overridden class functions ########## # ########## Overridden class functions ##########