|
|
|
@ -25,6 +25,7 @@
@@ -25,6 +25,7 @@
|
|
|
|
|
/// @author Don Gagne <don@thegagnes.com>
|
|
|
|
|
|
|
|
|
|
#include "QGCQmlWidgetHolder.h" |
|
|
|
|
#include "QGCMessageBox.h" |
|
|
|
|
|
|
|
|
|
QGCQmlWidgetHolder::QGCQmlWidgetHolder(QWidget *parent) : |
|
|
|
|
QWidget(parent) |
|
|
|
@ -43,8 +44,19 @@ void QGCQmlWidgetHolder::setAutoPilot(AutoPilotPlugin* autoPilot)
@@ -43,8 +44,19 @@ void QGCQmlWidgetHolder::setAutoPilot(AutoPilotPlugin* autoPilot)
|
|
|
|
|
_ui.qmlWidget->rootContext()->setContextProperty("autopilot", autoPilot); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void QGCQmlWidgetHolder::setSource(const QUrl& qmlUrl) |
|
|
|
|
bool QGCQmlWidgetHolder::setSource(const QUrl& qmlUrl) |
|
|
|
|
{ |
|
|
|
|
_ui.qmlWidget->setSource(qmlUrl); |
|
|
|
|
_ui.qmlWidget->setMinimumSize(_ui.qmlWidget->rootObject()->width(), _ui.qmlWidget->rootObject()->height()); |
|
|
|
|
if (_ui.qmlWidget->status() != QQuickWidget::Ready) { |
|
|
|
|
QString errorList; |
|
|
|
|
|
|
|
|
|
foreach (QQmlError error, _ui.qmlWidget->errors()) { |
|
|
|
|
errorList += error.toString(); |
|
|
|
|
errorList += "\n"; |
|
|
|
|
} |
|
|
|
|
QGCMessageBox::warning(tr("Qml Error"), tr("Source not ready: %1\nErrors:\n%2").arg(_ui.qmlWidget->status()).arg(errorList)); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|