diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-10-14 16:00:17 +1100 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-10-14 16:00:17 +1100 |
| commit | 27953a89d1110d6cc82ff198e1c28f698104d554 (patch) | |
| tree | 69b302d1f8c0150c9a61e57dad9b0dd80ff11e48 /plugin/src/Caelestia/appdb.hpp | |
| parent | toasts: add toast for kb layout change (diff) | |
| download | caelestia-shell-27953a89d1110d6cc82ff198e1c28f698104d554.tar.gz caelestia-shell-27953a89d1110d6cc82ff198e1c28f698104d554.tar.bz2 caelestia-shell-27953a89d1110d6cc82ff198e1c28f698104d554.zip | |
internal: use QQmlListProperty
Fix lsp errors
Diffstat (limited to 'plugin/src/Caelestia/appdb.hpp')
| -rw-r--r-- | plugin/src/Caelestia/appdb.hpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/plugin/src/Caelestia/appdb.hpp b/plugin/src/Caelestia/appdb.hpp index bb1a3f1..5f9b960 100644 --- a/plugin/src/Caelestia/appdb.hpp +++ b/plugin/src/Caelestia/appdb.hpp @@ -3,6 +3,7 @@ #include <qhash.h> #include <qobject.h> #include <qqmlintegration.h> +#include <qqmllist.h> #include <qtimer.h> namespace caelestia { @@ -64,8 +65,8 @@ class AppDb : public QObject { Q_PROPERTY(QString uuid READ uuid CONSTANT) Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged REQUIRED) - Q_PROPERTY(QList<QObject*> entries READ entries WRITE setEntries NOTIFY entriesChanged REQUIRED) - Q_PROPERTY(QList<AppEntry*> apps READ apps NOTIFY appsChanged) + Q_PROPERTY(QObjectList entries READ entries WRITE setEntries NOTIFY entriesChanged REQUIRED) + Q_PROPERTY(QQmlListProperty<caelestia::AppEntry> apps READ apps NOTIFY appsChanged) public: explicit AppDb(QObject* parent = nullptr); @@ -75,10 +76,10 @@ public: [[nodiscard]] QString path() const; void setPath(const QString& path); - [[nodiscard]] QList<QObject*> entries() const; - void setEntries(const QList<QObject*>& entries); + [[nodiscard]] QObjectList entries() const; + void setEntries(const QObjectList& entries); - [[nodiscard]] QList<AppEntry*> apps() const; + [[nodiscard]] QQmlListProperty<AppEntry> apps(); Q_INVOKABLE void incrementFrequency(const QString& id); @@ -92,9 +93,11 @@ private: const QString m_uuid; QString m_path; - QList<QObject*> m_entries; + QObjectList m_entries; QHash<QString, AppEntry*> m_apps; + mutable QList<AppEntry*> m_sortedApps; + QList<AppEntry*>& getSortedApps() const; quint32 getFrequency(const QString& id) const; void updateAppFrequencies(); void updateApps(); |