root qml item accessible from plasmoid.rootItem
this way objects in compactRepresentation can access the root object properties as plasmoid.rootItem.propertyName
This commit is contained in:
parent
9745fe5535
commit
dbc02cd44b
@ -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();
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user