openPilotLog
|
The AircraftWidget is used to view, edit, delete or add new tails. More...
#include <aircraftwidget.h>
Public Slots | |
void | onAircraftWidget_settingChanged (SettingsWidget::SettingSignal signal) |
invokes setupModelAndView() to account for changes the user has made in the SettingsWidget | |
void | onAircraftWidget_dataBaseUpdated () |
Refreshes the view if the Database has been altered from outside the AircraftWidget. | |
void | repopulateModel () |
AircraftWidget::repopulateModel (public slot) - re-populates the model to cater for a change to the database connection (for example, when a backup is created) | |
Public Member Functions | |
AircraftWidget (QWidget *parent=nullptr) | |
Protected Member Functions | |
void | changeEvent (QEvent *event) override |
Handles change events, like updating the UI to new localisation. | |
The AircraftWidget is used to view, edit, delete or add new tails.
The widget consists of two main parts, a QTableView on the left side and a QStackedWidget on the right side.
In the QTableView, a QSqlTableModel is used to access a view from the database, which holds a tails' Registration, Type and Company.
The welcome page shown on the QStackedWidget on the right side has a QLineEdit that functions as a search box and a QCombobox holding the possible columns that can be used to filter what is displayed. The text of the QLineEdit is used as a filter for the QSqlTableModel, so the view is updated in real time.
The NewTailDialog is used for creating a new entry as well as for editing an existing entry. If the user selects a row in the QTableView, the NewTailDilog is displayed on the right side of the Widget, inside the QStackedWidget. In order to avoid leaks from any previously made selections, existing Dialogs are deleted before a new one is created. The NewTailDialog's accepted
and rejected
signals are connected to refresh the view as required.
Note: The ATailEntry class is used to operate on individual aircraft, whereas the AAircraftEntry class is used to retreive templates of aircraft types. For example, 'D-ABCD' and 'N-XYZ' are different tails (Registrations), but they might be the same type of aircraft, for example 'Boeing 737-800'.