Fix for row height on long transcriptions with a lot of rows (#960)

This commit is contained in:
Raivis Dejus 2024-10-25 20:02:38 +03:00 committed by GitHub
commit c94671f3d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -117,6 +117,7 @@ class TranscriptionSegmentsEditorWidget(QTableView):
self.setSelectionMode(QTableView.SelectionMode.SingleSelection)
self.selectionModel().selectionChanged.connect(self.on_selection_changed)
model.select()
model.rowsInserted.connect(self.init_row_height)
self.has_translations = self.has_non_empty_translation()
@ -133,7 +134,9 @@ class TranscriptionSegmentsEditorWidget(QTableView):
def init_row_height(self):
font_metrics = QFontMetrics(self.font())
max_row_height = font_metrics.height() * 4
for row in range(self.model().rowCount()):
row_count = self.model().rowCount()
for row in range(row_count):
self.setRowHeight(row, max_row_height)
def has_non_empty_translation(self) -> bool: