Improve resize rows speed
This commit is contained in:
parent
90697652b0
commit
50b051a864
@ -789,7 +789,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
self.active_proxy_model().hide_played_tracks(True)
|
||||
self.btnHidePlayed.setText("Show played")
|
||||
# Reset row heights
|
||||
self.active_tab().resizeRowsToContents()
|
||||
self.active_tab().resize_rows()
|
||||
|
||||
def import_track(self) -> None:
|
||||
"""Import track file"""
|
||||
@ -1503,11 +1503,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
def tab_change(self):
|
||||
"""Called when active tab changed"""
|
||||
|
||||
log.info("tab_change()")
|
||||
|
||||
tab = self.active_tab()
|
||||
if tab:
|
||||
QTimer.singleShot(300, tab.resizeRowsToContents)
|
||||
self.active_tab().resize_rows()
|
||||
|
||||
def tick_10ms(self) -> None:
|
||||
"""
|
||||
|
||||
@ -209,7 +209,7 @@ class PlaylistTab(QTableView):
|
||||
h_header.sectionResized.connect(self._column_resize)
|
||||
h_header.setStretchLastSection(True)
|
||||
# Setting ResizeToContents causes screen flash on load
|
||||
QTimer.singleShot(300, self.resizeRowsToContents)
|
||||
self.resize_rows()
|
||||
|
||||
# ########## Overridden class functions ##########
|
||||
|
||||
@ -225,7 +225,7 @@ class PlaylistTab(QTableView):
|
||||
super(PlaylistTab, self).closeEditor(editor, hint)
|
||||
|
||||
# Optimise row heights after increasing row height for editing
|
||||
self.resizeRowsToContents()
|
||||
self.resize_rows()
|
||||
|
||||
# Update start times in case a start time in a note has been
|
||||
# edited
|
||||
@ -260,7 +260,7 @@ class PlaylistTab(QTableView):
|
||||
self.clear_selection()
|
||||
|
||||
# Resize rows
|
||||
self.resizeRowsToContents()
|
||||
self.resize_rows()
|
||||
|
||||
event.accept()
|
||||
|
||||
@ -716,14 +716,14 @@ class PlaylistTab(QTableView):
|
||||
self.source_model.rescan_track(row_number)
|
||||
self.clear_selection()
|
||||
|
||||
def resize_rows(self, playlist_id: int) -> None:
|
||||
def resize_rows(self, playlist_id: Optional[int] = None) -> None:
|
||||
"""
|
||||
If playlist_id is us, resize rows
|
||||
"""
|
||||
|
||||
log.info(f"resize_rows({playlist_id=}) {self.playlist_id=}")
|
||||
|
||||
if playlist_id != self.playlist_id:
|
||||
if playlist_id and playlist_id != self.playlist_id:
|
||||
return
|
||||
|
||||
# self.resizeRowsToContents()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user