1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-14 11:02:19 +01:00

Added default property to QmlPluginInterface for creating child items

This commit is contained in:
Anmol Gautam 2018-06-23 13:40:09 +05:30
parent c94976bf01
commit d3a56e0b4e
2 changed files with 9 additions and 0 deletions

View File

@ -188,6 +188,11 @@ void QmlPluginInterface::setPopulateWebViewMenu(const QJSValue &value)
m_populateWebViewMenu = value; m_populateWebViewMenu = value;
} }
QQmlListProperty<QObject> QmlPluginInterface::childItems()
{
return QQmlListProperty<QObject>(this, m_childItems);
}
void QmlPluginInterface::addButton(BrowserWindow *window) void QmlPluginInterface::addButton(BrowserWindow *window)
{ {
if (m_browserAction->location().testFlag(QmlBrowserAction::NavigationToolBar)) { if (m_browserAction->location().testFlag(QmlBrowserAction::NavigationToolBar)) {

View File

@ -36,6 +36,8 @@ class QmlPluginInterface : public QObject, public PluginInterface
Q_PROPERTY(QmlBrowserAction* browserAction READ browserAction WRITE setBrowserAction) Q_PROPERTY(QmlBrowserAction* browserAction READ browserAction WRITE setBrowserAction)
Q_PROPERTY(QmlSideBar* sideBar READ sideBar WRITE setSideBar) Q_PROPERTY(QmlSideBar* sideBar READ sideBar WRITE setSideBar)
Q_PROPERTY(QJSValue populateWebViewMenu READ readPopulateWebViewMenu WRITE setPopulateWebViewMenu) Q_PROPERTY(QJSValue populateWebViewMenu READ readPopulateWebViewMenu WRITE setPopulateWebViewMenu)
Q_PROPERTY(QQmlListProperty<QObject> childItems READ childItems)
Q_CLASSINFO("DefaultProperty", "childItems")
public: public:
explicit QmlPluginInterface(); explicit QmlPluginInterface();
@ -59,6 +61,7 @@ private:
QmlBrowserAction *m_browserAction; QmlBrowserAction *m_browserAction;
QmlSideBar *m_sideBar; QmlSideBar *m_sideBar;
QJSValue m_populateWebViewMenu; QJSValue m_populateWebViewMenu;
QList<QObject*> m_childItems;
QJSValue readInit() const; QJSValue readInit() const;
void setInit(const QJSValue &init); void setInit(const QJSValue &init);
@ -72,6 +75,7 @@ private:
void setSideBar(QmlSideBar *sideBar); void setSideBar(QmlSideBar *sideBar);
QJSValue readPopulateWebViewMenu() const; QJSValue readPopulateWebViewMenu() const;
void setPopulateWebViewMenu(const QJSValue &value); void setPopulateWebViewMenu(const QJSValue &value);
QQmlListProperty<QObject> childItems();
void addButton(BrowserWindow *window); void addButton(BrowserWindow *window);
void removeButton(BrowserWindow *window); void removeButton(BrowserWindow *window);