mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +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):
|
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.clear()
|
||||||
|
|
||||||
self.model.setHorizontalHeaderLabels(["Name", "Alt", "TOT/DEPART"])
|
self.model.setHorizontalHeaderLabels(["Name", "Alt", "TOT/DEPART"])
|
||||||
@ -39,7 +42,7 @@ class QFlightWaypointList(QTableView):
|
|||||||
for row, waypoint in enumerate(waypoints):
|
for row, waypoint in enumerate(waypoints):
|
||||||
self.add_waypoint_row(row, self.flight, waypoint)
|
self.add_waypoint_row(row, self.flight, waypoint)
|
||||||
self.selectionModel().setCurrentIndex(
|
self.selectionModel().setCurrentIndex(
|
||||||
self.indexAt(QPoint(1, 1)), QItemSelectionModel.Select
|
self.model.index(current_index, 0), QItemSelectionModel.Select
|
||||||
)
|
)
|
||||||
self.resizeColumnsToContents()
|
self.resizeColumnsToContents()
|
||||||
total_column_width = self.verticalHeader().width() + self.lineWidth()
|
total_column_width = self.verticalHeader().width() + self.lineWidth()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user