Debian Codegraph @

src/GUI/QmlPositionedModel.hxx

raw symbols SCIP
1 /*
2 * SPDX-FileName: QmlPositionedModel.hxx
3 * SPDX-License-Identifier: GPL-2.0-or-later
4 * SPDX-FileCopyrightText: Copyright (C) 2024 James Turner
5 */
6
7 #pragma once
8
9 #include <QAbstractListModel>
10 #include <memory>
11
12 #include <Airports/airports_fwd.hxx>
13 #include <Navaids/positioned.hxx>
14
15 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
16 Q_MOC_INCLUDE("QmlPositioned.hxx")
17 #endif
18
19 class QmlPositioned;
20
21 class QmlPositionedModel : public QAbstractListModel
22 {
23 Q_OBJECT
24
25 Q_PROPERTY(bool empty READ isEmpty NOTIFY sizeChanged)
26 public:
27 QmlPositionedModel(QObject* parent = nullptr);
28 ~QmlPositionedModel() override;
29
30 void setValues(const FGPositionedList& posItems);
31
32 void setValues(const FGRunwayList& runways);
33
34 void setValues(const FGParkingList& runways);
35
36 void clear();
37
38 int rowCount(const QModelIndex& parent) const override;
39
40 QHash<int, QByteArray> roleNames() const override;
41
42 QVariant data(const QModelIndex& m, int role) const override;
43
44 Q_INVOKABLE int indexOf(QmlPositioned* pos) const;
45
46 Q_INVOKABLE QmlPositioned* itemAt(int index) const;
47
48 bool isEmpty() const;
49 signals:
50 void sizeChanged();
51
52 private:
53 class QmlPositionedModelPrivate;
54 std::unique_ptr<QmlPositionedModelPrivate> d;
55 };