Changeset View
Changeset View
Standalone View
Standalone View
src/qtquick/quickengine.h
Show All 17 Lines | |||||
18 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | 18 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
19 | * | 19 | * | ||
20 | */ | 20 | */ | ||
21 | 21 | | |||
22 | #ifndef ENGINE_H | 22 | #ifndef ENGINE_H | ||
23 | #define ENGINE_H | 23 | #define ENGINE_H | ||
24 | 24 | | |||
25 | #include <QObject> | 25 | #include <QObject> | ||
26 | #include <entryinternal.h> | 26 | #include <QQmlListProperty> | ||
27 | | ||||
28 | #include "entrywrapper.h" | ||||
27 | 29 | | |||
28 | /** | 30 | /** | ||
29 | * @short Encapsulates a KNSCore::Engine for use in Qt Quick | 31 | * @short Encapsulates a KNSCore::Engine for use in Qt Quick | ||
30 | * | 32 | * | ||
31 | * This class takes care of initialisation of a KNSCore::Engine when assigned a config file. | 33 | * This class takes care of initialisation of a KNSCore::Engine when assigned a config file. | ||
32 | * The actual KNSCore:Engine can be read through the Engine::engine property. | 34 | * The actual KNSCore:Engine can be read through the Engine::engine property. | ||
33 | * | 35 | * | ||
34 | * @see ItemsModel | 36 | * @see ItemsModel | ||
Show All 11 Lines | 39 | { | |||
46 | Q_PROPERTY(bool isLoading READ isLoading NOTIFY isLoadingChanged) | 48 | Q_PROPERTY(bool isLoading READ isLoading NOTIFY isLoadingChanged) | ||
47 | Q_PROPERTY(bool hasAdoptionCommand READ hasAdoptionCommand NOTIFY engineInitialized) | 49 | Q_PROPERTY(bool hasAdoptionCommand READ hasAdoptionCommand NOTIFY engineInitialized) | ||
48 | Q_PROPERTY(QString name READ name NOTIFY engineInitialized) | 50 | Q_PROPERTY(QString name READ name NOTIFY engineInitialized) | ||
49 | Q_PROPERTY(QObject* categories READ categories NOTIFY categoriesChanged) | 51 | Q_PROPERTY(QObject* categories READ categories NOTIFY categoriesChanged) | ||
50 | Q_PROPERTY(QStringList categoriesFilter READ categoriesFilter WRITE setCategoriesFilter RESET resetCategoriesFilter NOTIFY categoriesFilterChanged) | 52 | Q_PROPERTY(QStringList categoriesFilter READ categoriesFilter WRITE setCategoriesFilter RESET resetCategoriesFilter NOTIFY categoriesFilterChanged) | ||
51 | Q_PROPERTY(int filter READ filter WRITE setFilter NOTIFY filterChanged) | 53 | Q_PROPERTY(int filter READ filter WRITE setFilter NOTIFY filterChanged) | ||
52 | Q_PROPERTY(int sortOrder READ sortOrder WRITE setSortOrder NOTIFY sortOrderChanged) | 54 | Q_PROPERTY(int sortOrder READ sortOrder WRITE setSortOrder NOTIFY sortOrderChanged) | ||
53 | Q_PROPERTY(QString searchTerm READ searchTerm WRITE setSearchTerm RESET resetSearchTerm NOTIFY searchTermChanged) | 55 | Q_PROPERTY(QString searchTerm READ searchTerm WRITE setSearchTerm RESET resetSearchTerm NOTIFY searchTermChanged) | ||
54 | Q_PROPERTY(KNSCore::EntryInternal::List changedEntries READ changedEntries RESET resetChangedEntries NOTIFY changedEntriesChanged) | 56 | Q_PROPERTY(QQmlListProperty<KNSCore::EntryWrapper> changedEntries READ changedEntries NOTIFY changedEntriesChanged) | ||
davidedmundson: Why QObject here?
One of the main advantages of using QQmlListProperty over QList<QObject*> is… | |||||
Quite simply because i, in my test code, had something around the wrong way... Updated patch incoming. leinir: Quite simply because i, in my test code, had something around the wrong way... Updated patch… | |||||
55 | Q_PROPERTY(int changedEntriesCount READ changedEntriesCount NOTIFY changedEntriesChanged) | 57 | Q_PROPERTY(int changedEntriesCount READ changedEntriesCount NOTIFY changedEntriesChanged) | ||
56 | public: | 58 | public: | ||
57 | explicit Engine(QObject *parent = nullptr); | 59 | explicit Engine(QObject *parent = nullptr); | ||
58 | virtual ~Engine(); | 60 | virtual ~Engine(); | ||
59 | 61 | | |||
60 | bool allowedByKiosk() const; | 62 | bool allowedByKiosk() const; | ||
61 | 63 | | |||
62 | QString configFile() const; | 64 | QString configFile() const; | ||
Show All 34 Lines | |||||
97 | void setSortOrder(int newSortOrder); | 99 | void setSortOrder(int newSortOrder); | ||
98 | Q_SIGNAL void sortOrderChanged(); | 100 | Q_SIGNAL void sortOrderChanged(); | ||
99 | 101 | | |||
100 | QString searchTerm() const; | 102 | QString searchTerm() const; | ||
101 | void setSearchTerm(const QString &newSearchTerm); | 103 | void setSearchTerm(const QString &newSearchTerm); | ||
102 | Q_INVOKABLE void resetSearchTerm(); | 104 | Q_INVOKABLE void resetSearchTerm(); | ||
103 | Q_SIGNAL void searchTermChanged(); | 105 | Q_SIGNAL void searchTermChanged(); | ||
104 | 106 | | |||
105 | KNSCore::EntryInternal::List changedEntries() const; | 107 | QQmlListProperty<KNSCore::EntryWrapper> changedEntries(); | ||
106 | Q_INVOKABLE void resetChangedEntries(); | 108 | Q_INVOKABLE void resetChangedEntries(); | ||
107 | Q_SIGNAL void changedEntriesChanged(); | 109 | Q_SIGNAL void changedEntriesChanged(); | ||
108 | int changedEntriesCount() const; | 110 | int changedEntriesCount() const; | ||
109 | Q_SIGNALS: | 111 | Q_SIGNALS: | ||
110 | void message(const QString &message); | 112 | void message(const QString &message); | ||
111 | void idleMessage(const QString &message); | 113 | void idleMessage(const QString &message); | ||
112 | void busyMessage(const QString &message); | 114 | void busyMessage(const QString &message); | ||
113 | void errorMessage(const QString &message); | 115 | void errorMessage(const QString &message); | ||
114 | 116 | | |||
115 | private: | 117 | private: | ||
116 | class Private; | 118 | class Private; | ||
117 | Private *d; | 119 | Private *d; | ||
118 | }; | 120 | }; | ||
119 | 121 | | |||
120 | #endif//ENGINE_H | 122 | #endif//ENGINE_H |
Why QObject here?
One of the main advantages of using QQmlListProperty over QList<QObject*> is that you can specify the derived type.