diff --git a/src/plasmaquick/configview.h b/src/plasmaquick/configview.h --- a/src/plasmaquick/configview.h +++ b/src/plasmaquick/configview.h @@ -89,6 +89,17 @@ Q_PRIVATE_SLOT(d, void updateMaximumHeight()) }; +// WORKAROUND FOR BUG: 393630 +class PlasmoidRootItem : public QObject +{ + Q_OBJECT +public: + PlasmoidRootItem(QObject *rootItem, QObject *parent = nullptr); + Q_INVOKABLE QVariant get(const QString p); +private: + QObject *m_rootItem {nullptr}; +}; +// <-- END WORKAROUND } #endif // multiple inclusion guard diff --git a/src/plasmaquick/configview.cpp b/src/plasmaquick/configview.cpp --- a/src/plasmaquick/configview.cpp +++ b/src/plasmaquick/configview.cpp @@ -170,8 +170,20 @@ } } - q->engine()->rootContext()->setContextProperty(QStringLiteral("plasmoid"), applet.data()->property("_plasma_graphicObject").value()); + QObject *plasmoid = applet.data()->property("_plasma_graphicObject").value(); + + // WORKAROUND FOR BUG: 393630 + // Usage: in SystemTray's ConfigEntries.qml + // use plasmoidRootItem.get(string property) instead of plasmoid.rootItem.property + + PlasmoidRootItem *plasmoidRootItem = new PlasmoidRootItem(plasmoid->property("rootItem").value(), q); + q->engine()->rootContext()->setContextProperty(QStringLiteral("plasmoidRootItem"), plasmoidRootItem); + + // <-- END WORKAROUND + + q->engine()->rootContext()->setContextProperty(QStringLiteral("plasmoid"), plasmoid); q->engine()->rootContext()->setContextProperty(QStringLiteral("configDialog"), q); + component->completeCreate(); delete component; } @@ -354,6 +366,17 @@ QQuickWindow::resizeEvent(re); } +PlasmoidRootItem::PlasmoidRootItem(QObject *rootItem, QObject *parent) + : QObject(parent), m_rootItem(rootItem) +{ +} + +QVariant PlasmoidRootItem::get(const QString p) +{ + QByteArray ba = p.toLatin1(); + const char *c_str = ba.data(); + return m_rootItem? m_rootItem->property(c_str) : QVariant(); +} } #include "moc_configview.cpp"