Better management of hiding played sections
Only scroll if top visible line is above current header.
This commit is contained in:
parent
c12b30a956
commit
6792b2a628
@ -5,9 +5,10 @@ from typing import Any, Callable, cast, Optional, TYPE_CHECKING
|
|||||||
from PyQt6.QtCore import (
|
from PyQt6.QtCore import (
|
||||||
QAbstractItemModel,
|
QAbstractItemModel,
|
||||||
QEvent,
|
QEvent,
|
||||||
|
QItemSelection,
|
||||||
QModelIndex,
|
QModelIndex,
|
||||||
QObject,
|
QObject,
|
||||||
QItemSelection,
|
QPoint,
|
||||||
QSize,
|
QSize,
|
||||||
Qt,
|
Qt,
|
||||||
QTimer,
|
QTimer,
|
||||||
@ -838,12 +839,28 @@ class PlaylistTab(QTableView):
|
|||||||
log.debug(f"get_selected_rows() returned: {result=}")
|
log.debug(f"get_selected_rows() returned: {result=}")
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def hide_played_sections(self) -> None:
|
def get_top_visible_row(self) -> int:
|
||||||
"""
|
"""
|
||||||
Scroll played sections off screen
|
Get the viewport of the table view
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.scroll_to_top(self.get_base_model().active_section_header())
|
index = self.indexAt(QPoint(0, 0))
|
||||||
|
|
||||||
|
if index.isValid():
|
||||||
|
return index.row()
|
||||||
|
else:
|
||||||
|
# If no index is found, it means the table might be empty or scrolled beyond content
|
||||||
|
return -1
|
||||||
|
|
||||||
|
def hide_played_sections(self) -> None:
|
||||||
|
"""
|
||||||
|
Scroll played sections off screen, but only if current top row is above
|
||||||
|
the active header
|
||||||
|
"""
|
||||||
|
|
||||||
|
active_header_row = self.get_base_model().active_section_header()
|
||||||
|
if self.get_top_visible_row() < active_header_row:
|
||||||
|
self.scroll_to_top(active_header_row)
|
||||||
|
|
||||||
def _import_from_audacity(self, row_number: int) -> None:
|
def _import_from_audacity(self, row_number: int) -> None:
|
||||||
"""
|
"""
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user