Fix for row highlighting on Windows

This commit is contained in:
Raivis Dejus 2025-09-05 09:50:20 +03:00
commit 8e6dec746d

View file

@ -80,6 +80,7 @@ class TranscriptionSegmentsEditorWidget(QTableView):
):
super().__init__(parent)
self._last_highlighted_row = -1
self.translator = translator
self.translator.translation.connect(self.update_translation)
@ -186,6 +187,11 @@ class TranscriptionSegmentsEditorWidget(QTableView):
def highlight_and_scroll_to_row(self, row_index: int):
"""Highlight a specific row and scroll it into view"""
if 0 <= row_index < self.model().rowCount():
# Only set focus if we're actually moving to a different row to avoid audio crackling
if self._last_highlighted_row != row_index:
self.setFocus()
self._last_highlighted_row = row_index
# Select the row
self.selectRow(row_index)
# Scroll to the row with better positioning