Fix moving rows when played rows are hidden

Fixes #210
This commit is contained in:
Keith Edmunds 2023-12-08 13:35:22 +00:00
parent e313e84010
commit 06ef175b46

View File

@ -234,13 +234,15 @@ class PlaylistTab(QTableView):
super().dropEvent(event)
from_rows = self.selected_model_row_numbers()
to_row = self.indexAt(event.position().toPoint()).row()
to_index = self.indexAt(event.position().toPoint())
to_model_row = self.proxy_model.mapToSource(to_index).row()
if (
0 <= min(from_rows) <= self.model().rowCount()
and 0 <= max(from_rows) <= self.model().rowCount()
and 0 <= to_row <= self.model().rowCount()
0 <= min(from_rows) <= self.data_model.rowCount()
and 0 <= max(from_rows) <= self.data_model.rowCount()
and 0 <= to_model_row <= self.data_model.rowCount()
):
self.model().move_rows(from_rows, to_row)
self.data_model.move_rows(from_rows, to_model_row)
# Reset drag mode to allow row selection by dragging
self.setDragEnabled(False)