From d3a56e0b4edc5563c81ff05f542119214bb4a58a Mon Sep 17 00:00:00 2001 From: Anmol Gautam Date: Sat, 23 Jun 2018 13:40:09 +0530 Subject: [PATCH] Added default property to QmlPluginInterface for creating child items --- src/lib/plugins/qml/qmlplugininterface.cpp | 5 +++++ src/lib/plugins/qml/qmlplugininterface.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/lib/plugins/qml/qmlplugininterface.cpp b/src/lib/plugins/qml/qmlplugininterface.cpp index 5c8216d1d..dc8241963 100644 --- a/src/lib/plugins/qml/qmlplugininterface.cpp +++ b/src/lib/plugins/qml/qmlplugininterface.cpp @@ -188,6 +188,11 @@ void QmlPluginInterface::setPopulateWebViewMenu(const QJSValue &value) m_populateWebViewMenu = value; } +QQmlListProperty QmlPluginInterface::childItems() +{ + return QQmlListProperty(this, m_childItems); +} + void QmlPluginInterface::addButton(BrowserWindow *window) { if (m_browserAction->location().testFlag(QmlBrowserAction::NavigationToolBar)) { diff --git a/src/lib/plugins/qml/qmlplugininterface.h b/src/lib/plugins/qml/qmlplugininterface.h index 0f7e9d058..b84854403 100644 --- a/src/lib/plugins/qml/qmlplugininterface.h +++ b/src/lib/plugins/qml/qmlplugininterface.h @@ -36,6 +36,8 @@ class QmlPluginInterface : public QObject, public PluginInterface Q_PROPERTY(QmlBrowserAction* browserAction READ browserAction WRITE setBrowserAction) Q_PROPERTY(QmlSideBar* sideBar READ sideBar WRITE setSideBar) Q_PROPERTY(QJSValue populateWebViewMenu READ readPopulateWebViewMenu WRITE setPopulateWebViewMenu) + Q_PROPERTY(QQmlListProperty childItems READ childItems) + Q_CLASSINFO("DefaultProperty", "childItems") public: explicit QmlPluginInterface(); @@ -59,6 +61,7 @@ private: QmlBrowserAction *m_browserAction; QmlSideBar *m_sideBar; QJSValue m_populateWebViewMenu; + QList m_childItems; QJSValue readInit() const; void setInit(const QJSValue &init); @@ -72,6 +75,7 @@ private: void setSideBar(QmlSideBar *sideBar); QJSValue readPopulateWebViewMenu() const; void setPopulateWebViewMenu(const QJSValue &value); + QQmlListProperty childItems(); void addButton(BrowserWindow *window); void removeButton(BrowserWindow *window);