swift
aircraftmodellistmodel.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_GUI_MODELS_AIRCRAFTMODELLISTMODEL_H
7 #define SWIFT_GUI_MODELS_AIRCRAFTMODELLISTMODEL_H
8 
9 #include <QBrush>
10 #include <QStringList>
11 #include <QVariant>
12 #include <Qt>
13 
15 #include "gui/swiftguiexport.h"
17 
18 class QModelIndex;
19 
20 namespace swift::misc::simulation
21 {
22  class CAircraftModel;
23 }
24 namespace swift::gui::models
25 {
28  public COrderableListModelDbObjects<swift::misc::simulation::CAircraftModelList, int, true>
29  {
30  Q_OBJECT
31 
32  public:
36  {
37  NotSet,
43  VPilotRuleModel
44  };
45 
47  explicit CAircraftModelListModel(AircraftModelMode mode, QObject *parent = nullptr);
48 
50  virtual ~CAircraftModelListModel() override {}
51 
53  void setAircraftModelMode(CAircraftModelListModel::AircraftModelMode stationMode);
54 
56  AircraftModelMode getModelMode() const { return m_mode; }
57 
59  void setHighlightModelStrings(const QStringList &modelStrings = QStringList());
60 
62  void setHighlightModels(const swift::misc::simulation::CAircraftModelList &highlightModels);
63 
65  bool highlightModels() const { return m_highlightModels; }
66 
68  void setHighlight(bool highlightModels);
69 
71  void setHighlightColor(const QBrush &brush) { m_highlightColor = brush; }
72 
74  virtual void clearHighlighting() override;
75 
77  virtual bool hasHighlightedRows() const override;
78 
80  QStringList getModelStrings(bool sort) const;
81 
83  void replaceOrAddByModelString(const swift::misc::simulation::CAircraftModelList &models);
84 
86  virtual QVariant data(const QModelIndex &index, int role) const override;
87 
89  virtual bool isOrderable() const override { return true; }
90 
91  private:
92  AircraftModelMode m_mode = NotSet;
93  bool m_highlightModels = false;
94  QStringList m_highlightStrings;
95  QBrush m_highlightColor { Qt::yellow };
96  };
97 } // namespace swift::gui::models
98 #endif // SWIFT_GUI_MODELS_AIRCRAFTMODELLISTMODEL_H
virtual bool isOrderable() const
Orderable, normally use a container swift::misc::IOrderableList.
void setHighlightColor(const QBrush &brush)
The highlight color.
@ OwnAircraftModelMappingTool
models of my simulator, but in mapping mode
@ OwnAircraftModelClient
models existing for my simulator
Value object encapsulating a list of aircraft models.
Models to be used with views, mainly QTableView.
#define SWIFT_GUI_EXPORT
Export a class or function from the library.