23#include <QAbstractListModel>
24#include <QFileSystemWatcher>
50 QML_UNCREATABLE(
"Use Librarian.aircraftModel or Librarian.routesModel")
69 explicit FileLibraryModel(QString directory, QString suffix, QObject* parent =
nullptr);
83 [[nodiscard]] QStringList
names()
const {
return m_names; }
96 [[nodiscard]]
int rowCount(
const QModelIndex& parent = QModelIndex())
const override;
106 [[nodiscard]] QVariant
data(
const QModelIndex& index,
int role = Qt::DisplayRole)
const override;
112 [[nodiscard]] QHash<int, QByteArray>
roleNames()
const override;
128 [[nodiscard]] QStringList scan()
const;
132 static bool lessThan(
const QString& first,
const QString& second);
140 QFileSystemWatcher m_watcher;
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Re-implemented from QAbstractListModel.
QStringList names() const
Base names of the library entries.
void refresh()
Rescans the directory.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Re-implemented from QAbstractListModel.
@ NameRole
Base name of the entry, a QString.
FileLibraryModel(QString directory, QString suffix, QObject *parent=nullptr)
Standard constructor.
QHash< int, QByteArray > roleNames() const override
Re-implemented from QAbstractListModel.