mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Reselect same row after deleting waypoint.
This commit is contained in:
parent
f2bd7300aa
commit
e94657875f
@ -31,6 +31,9 @@ class QFlightWaypointList(QTableView):
|
||||
)
|
||||
|
||||
def update_list(self):
|
||||
# We need to keep just the row and rebuild the index later because the
|
||||
# QModelIndex will not be valid after the model is cleared.
|
||||
current_index = self.currentIndex().row()
|
||||
self.model.clear()
|
||||
|
||||
self.model.setHorizontalHeaderLabels(["Name", "Alt", "TOT/DEPART"])
|
||||
@ -39,7 +42,7 @@ class QFlightWaypointList(QTableView):
|
||||
for row, waypoint in enumerate(waypoints):
|
||||
self.add_waypoint_row(row, self.flight, waypoint)
|
||||
self.selectionModel().setCurrentIndex(
|
||||
self.indexAt(QPoint(1, 1)), QItemSelectionModel.Select
|
||||
self.model.index(current_index, 0), QItemSelectionModel.Select
|
||||
)
|
||||
self.resizeColumnsToContents()
|
||||
total_column_width = self.verticalHeader().width() + self.lineWidth()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user