1
0
Fork 0
flightgear/src/GUI/RecentAircraftModel.hxx
James Turner f3a1c10b24 Fix bug #2306 - missed refresh of the history model
The HistoryPopup was caching its contents rather early, and we failed
to tell the model when its underlying data updated. Connect that
through so the history model refreshes also.

https://sourceforge.net/p/flightgear/codetickets/2036/
2018-07-23 09:34:31 +01:00

44 lines
913 B
C++

#ifndef RECENTAIRCRAFTMODEL_HXX
#define RECENTAIRCRAFTMODEL_HXX
#include <QAbstractListModel>
#include <QUrl>
// forward decls
class AircraftItemModel;
class RecentAircraftModel : public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(bool isEmpty READ isEmpty NOTIFY isEmptyChanged)
public:
RecentAircraftModel(AircraftItemModel *acModel, QObject* pr = nullptr);
QVariant data(const QModelIndex &index, int role) const override;
int rowCount(const QModelIndex &parent) const override;
QHash<int, QByteArray> roleNames() const override;
QUrl mostRecent() const;
void insert(QUrl aircraftUrl);
void saveToSettings();
Q_INVOKABLE QUrl uriAt(int index) const;
bool isEmpty() const;
signals:
void isEmptyChanged();
private:
void onModelContentsChanged();
AircraftItemModel* m_aircraftModel;
QList<QUrl> m_data;
};
#endif // RECENTAIRCRAFTMODEL_HXX