Commit b6376530 authored by Don Gagne's avatar Don Gagne

Add setContextPropertyObject api

parent 474bd6bc
......@@ -40,10 +40,15 @@ QGCQmlWidgetHolder::~QGCQmlWidgetHolder()
void QGCQmlWidgetHolder::setAutoPilot(AutoPilotPlugin* autoPilot)
{
_ui.qmlWidget->rootContext()->setContextProperty("autopilot", autoPilot);
setContextPropertyObject("autopilot", autoPilot);
}
bool QGCQmlWidgetHolder::setSource(const QUrl& qmlUrl)
{
return _ui.qmlWidget->setSource(qmlUrl);
}
void QGCQmlWidgetHolder::setContextPropertyObject(const QString& name, QObject* object)
{
_ui.qmlWidget->rootContext()->setContextProperty(name, object);
}
......@@ -52,6 +52,8 @@ public:
/// Sets the QML into the control. Will display errors message box if error occurs loading source.
/// @return true: source loaded, false: source not loaded, errors occured
bool setSource(const QUrl& qmlUrl);
void setContextPropertyObject(const QString& name, QObject* object);
private:
Ui::QGCQmlWidgetHolder _ui;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment