Edit Flight window is now dynamically sized.

This means that the waypoint names no longer get cut off.

Contributes-to: Khopa/dcs_liberation#754
This commit is contained in:
Simon Clark 2021-01-10 13:07:02 +00:00
parent 6f5bb6ffa2
commit 7269dbb79d
2 changed files with 6 additions and 2 deletions

View File

@ -20,7 +20,7 @@ class QEditFlightDialog(QDialog):
self.game_model = game_model
self.setWindowTitle("Create flight")
self.setWindowTitle("Edit flight")
self.setWindowIcon(EVENT_ICONS["strike"])
layout = QVBoxLayout()

View File

@ -19,7 +19,6 @@ class QFlightWaypointList(QTableView):
self.model = QStandardItemModel(self)
self.setModel(self.model)
self.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
self.model.setHorizontalHeaderLabels(["Name", "Alt", "TOT/DEPART"])
header = self.horizontalHeader()
@ -41,6 +40,11 @@ class QFlightWaypointList(QTableView):
self.add_waypoint_row(row, self.flight, waypoint)
self.selectionModel().setCurrentIndex(self.indexAt(QPoint(1, 1)),
QItemSelectionModel.Select)
self.resizeColumnsToContents()
total_column_width = self.verticalHeader().width() + self.lineWidth()
for i in range(0, self.model.columnCount()):
total_column_width += self.columnWidth(i) + self.lineWidth()
self.setFixedWidth(total_column_width)
def add_waypoint_row(self, row: int, flight: Flight,
waypoint: FlightWaypoint) -> None: