diff options
Diffstat (limited to 'plugin/src/Caelestia/Models')
| -rw-r--r-- | plugin/src/Caelestia/Models/filesystemmodel.cpp | 4 | ||||
| -rw-r--r-- | plugin/src/Caelestia/Models/filesystemmodel.hpp | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/plugin/src/Caelestia/Models/filesystemmodel.cpp b/plugin/src/Caelestia/Models/filesystemmodel.cpp index 3ceb1dd..e387ecd 100644 --- a/plugin/src/Caelestia/Models/filesystemmodel.cpp +++ b/plugin/src/Caelestia/Models/filesystemmodel.cpp @@ -211,8 +211,8 @@ void FileSystemModel::setNameFilters(const QStringList& nameFilters) { update(); } -QList<FileSystemEntry*> FileSystemModel::entries() const { - return m_entries; +QQmlListProperty<FileSystemEntry> FileSystemModel::entries() { + return QQmlListProperty<FileSystemEntry>(this, &m_entries); } void FileSystemModel::watchDirIfRecursive(const QString& path) { diff --git a/plugin/src/Caelestia/Models/filesystemmodel.hpp b/plugin/src/Caelestia/Models/filesystemmodel.hpp index cead43f..cf8eae8 100644 --- a/plugin/src/Caelestia/Models/filesystemmodel.hpp +++ b/plugin/src/Caelestia/Models/filesystemmodel.hpp @@ -8,6 +8,7 @@ #include <qmimedatabase.h> #include <qobject.h> #include <qqmlintegration.h> +#include <qqmllist.h> namespace caelestia::models { @@ -71,7 +72,7 @@ class FileSystemModel : public QAbstractListModel { Q_PROPERTY(Filter filter READ filter WRITE setFilter NOTIFY filterChanged) Q_PROPERTY(QStringList nameFilters READ nameFilters WRITE setNameFilters NOTIFY nameFiltersChanged) - Q_PROPERTY(QList<FileSystemEntry*> entries READ entries NOTIFY entriesChanged) + Q_PROPERTY(QQmlListProperty<caelestia::models::FileSystemEntry> entries READ entries NOTIFY entriesChanged) public: enum Filter { @@ -109,7 +110,7 @@ public: [[nodiscard]] QStringList nameFilters() const; void setNameFilters(const QStringList& nameFilters); - [[nodiscard]] QList<FileSystemEntry*> entries() const; + [[nodiscard]] QQmlListProperty<FileSystemEntry> entries(); signals: void pathChanged(); |