diff --git a/src/scriptengines/qml/plasmoid/appletinterface.cpp b/src/scriptengines/qml/plasmoid/appletinterface.cpp index b5d1bd0ce..289ffe4cb 100644 --- a/src/scriptengines/qml/plasmoid/appletinterface.cpp +++ b/src/scriptengines/qml/plasmoid/appletinterface.cpp @@ -135,6 +135,7 @@ void AppletInterface::init() m_qmlObject->engine()->rootContext()->setContextProperty("plasmoid", this); m_qmlObject->completeInitialization(); + emit rootItemChanged(); qDebug() << "Graphic object created:" << applet() << applet()->property("graphicObject"); @@ -208,6 +209,14 @@ QObject* AppletInterface::configuration() const return m_configuration; } +QObject* AppletInterface::rootItem() const +{ + if (!m_qmlObject) { + return 0; + } + return m_qmlObject->rootObject(); +} + QString AppletInterface::icon() const { return applet()->icon(); diff --git a/src/scriptengines/qml/plasmoid/appletinterface.h b/src/scriptengines/qml/plasmoid/appletinterface.h index cb8c1552f..126cfd8c0 100644 --- a/src/scriptengines/qml/plasmoid/appletinterface.h +++ b/src/scriptengines/qml/plasmoid/appletinterface.h @@ -50,6 +50,10 @@ class AppletInterface : public QQuickItem { Q_OBJECT + /** + * The QML root object defined in the applet main.qml + */ + Q_PROPERTY(QObject *rootItem READ rootItem NOTIFY rootItemChanged) Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged) //TODO: writable icon Q_PROPERTY(QString icon READ icon CONSTANT) @@ -116,6 +120,8 @@ public: //PROPERTY ACCESSORS------------------------------------------------------------------- + QObject *rootItem() const; + QString icon() const; QString title() const; @@ -176,6 +182,7 @@ Q_SIGNALS: void backgroundHintsChanged(); void busyChanged(); void expandedChanged(); + void rootItemChanged(); void minimumWidthChanged(); void minimumHeightChanged();