| openPilotLog

aircraftwidget.h
1 /*
2 *openPilotLog - A FOSS Pilot Logbook Application
3 *Copyright (C) 2020-2021 Felix Turowsky
4 *
5 *This program is free software: you can redistribute it and/or modify
6 *it under the terms of the GNU General Public License as published by
7 *the Free Software Foundation, either version 3 of the License, or
8 *(at your option) any later version.
9 *
10 *This program is distributed in the hope that it will be useful,
11 *but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 *GNU General Public License for more details.
14 *
15 *You should have received a copy of the GNU General Public License
16 *along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18 #ifndef AIRCRAFTWIDGET_H
19 #define AIRCRAFTWIDGET_H
20
21 #include <QWidget>
22 #include <QItemSelection>
23 #include <QSqlTableModel>
24 #include <QTableView>
25 #include "src/gui/widgets/settingswidget.h"
26 #include "src/gui/dialogues/newtaildialog.h"
27
28
29 namespace Ui {
30 class AircraftWidget;
31 }
53 class AircraftWidget : public QWidget
54 {
55 Q_OBJECT
56
57 public:
58 explicit AircraftWidget(QWidget *parent = nullptr);
59 ~AircraftWidget();
60
61 private slots:
62 void tableView_selectionChanged();
63
64 void tableView_headerClicked(int column);
65
66 void on_deleteAircraftButton_clicked();
67
68 void on_newAircraftButton_clicked();
69
70 void onNewTailDialog_editingFinished();
71
72 void on_aircraftSearchLineEdit_textChanged(const QString &arg1);
73
74 public slots:
78 void onAircraftWidget_settingChanged(SettingsWidget::SettingSignal signal);
82 void onAircraftWidget_dataBaseUpdated();
83
88 void repopulateModel();
89 private:
90 Ui::AircraftWidget *ui;
91
92 QSqlTableModel *model;
93
94 QTableView *view;
95
96 QItemSelectionModel* selection;
97
98 qint32 sortColumn;
99
103 QVector<qint32> selectedTails;
104
105 void setupModelAndView();
106
107 void connectSignalsAndSlots();
108
109 void onDeleteUnsuccessful();
110
111 inline void refreshView(){model->select();}
112
113 protected:
117 void changeEvent(QEvent* event) override;
118 };
119
120 #endif // AIRCRAFTWIDGET_H
AircraftWidget
The AircraftWidget is used to view, edit, delete or add new tails.
Definition: aircraftwidget.h:54
AircraftWidget::repopulateModel
void repopulateModel()
AircraftWidget::repopulateModel (public slot) - re-populates the model to cater for a change to the d...
Definition: aircraftwidget.cpp:251
AircraftWidget::onAircraftWidget_settingChanged
void onAircraftWidget_settingChanged(SettingsWidget::SettingSignal signal)
invokes setupModelAndView() to account for changes the user has made in the SettingsWidget
Definition: aircraftwidget.cpp:84
AircraftWidget::changeEvent
void changeEvent(QEvent *event) override
Handles change events, like updating the UI to new localisation.
Definition: aircraftwidget.cpp:97
AircraftWidget::onAircraftWidget_dataBaseUpdated
void onAircraftWidget_dataBaseUpdated()
Refreshes the view if the Database has been altered from outside the AircraftWidget.
Definition: aircraftwidget.cpp:92
SettingsWidget::SettingSignal
SettingSignal
enumerates Widgets that need to receive a signal when a setting is updated.
Definition: settingswidget.h:51