Changeset View
Changeset View
Standalone View
Standalone View
src/pagepool.h
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | 36 | public: | |||
---|---|---|---|---|---|
51 | * @param callback If we are loading a remote url, we can't have the item immediately but will be passed as a parameter to the provided callback. | 51 | * @param callback If we are loading a remote url, we can't have the item immediately but will be passed as a parameter to the provided callback. | ||
52 | * Normally, don't set a callback, use it only in case of remote urls. | 52 | * Normally, don't set a callback, use it only in case of remote urls. | ||
53 | * @returns the page instance that will have been created if necessary. | 53 | * @returns the page instance that will have been created if necessary. | ||
54 | * If the url is remote it will return null, | 54 | * If the url is remote it will return null, | ||
55 | * as well will return null if the callback has been provided | 55 | * as well will return null if the callback has been provided | ||
56 | */ | 56 | */ | ||
57 | Q_INVOKABLE QQuickItem *loadPage(const QString &url, QJSValue callback = QJSValue()); | 57 | Q_INVOKABLE QQuickItem *loadPage(const QString &url, QJSValue callback = QJSValue()); | ||
58 | 58 | | |||
59 | Q_INVOKABLE QQuickItem *loadPageWithProperties( | ||||
60 | const QString &url, const QVariantMap &properties, QJSValue callback = QJSValue()); | ||||
61 | | ||||
59 | /** | 62 | /** | ||
60 | * @returns The url of the page for the given instance, empty if there is no correspondence | 63 | * @returns The url of the page for the given instance, empty if there is no correspondence | ||
61 | */ | 64 | */ | ||
62 | Q_INVOKABLE QUrl urlForPage(QQuickItem *item) const; | 65 | Q_INVOKABLE QUrl urlForPage(QQuickItem *item) const; | ||
63 | 66 | | |||
64 | /** | 67 | /** | ||
65 | * @returns true if the is managed by the PagePool | 68 | * @returns true if the is managed by the PagePool | ||
66 | * @param the page can be either a QQuickItem or an url | 69 | * @param the page can be either a QQuickItem or an url | ||
Show All 17 Lines | |||||
84 | */ | 87 | */ | ||
85 | Q_INVOKABLE bool isLocalUrl(const QUrl &url); | 88 | Q_INVOKABLE bool isLocalUrl(const QUrl &url); | ||
86 | 89 | | |||
87 | Q_SIGNALS: | 90 | Q_SIGNALS: | ||
88 | void lastLoadedUrlChanged(); | 91 | void lastLoadedUrlChanged(); | ||
89 | void cachePagesChanged(); | 92 | void cachePagesChanged(); | ||
90 | 93 | | |||
91 | private: | 94 | private: | ||
92 | QQuickItem *createFromComponent(QQmlComponent *component); | 95 | QQuickItem *createFromComponent(QQmlComponent *component, const QVariantMap &properties); | ||
93 | 96 | | |||
94 | QUrl m_lastLoadedUrl; | 97 | QUrl m_lastLoadedUrl; | ||
95 | QPointer <QQuickItem> m_lastLoadedItem; | 98 | QPointer <QQuickItem> m_lastLoadedItem; | ||
96 | QHash<QUrl, QQuickItem *> m_itemForUrl; | 99 | QHash<QUrl, QQuickItem *> m_itemForUrl; | ||
97 | QHash<QUrl, QQmlComponent *> m_componentForUrl; | 100 | QHash<QUrl, QQmlComponent *> m_componentForUrl; | ||
98 | QHash<QQuickItem *, QUrl> m_urlForItem; | 101 | QHash<QQuickItem *, QUrl> m_urlForItem; | ||
99 | 102 | | |||
100 | bool m_cachePages = true; | 103 | bool m_cachePages = true; | ||
101 | }; | 104 | }; | ||
102 | 105 | |