Showing the changes to interface/src/ui/InteractiveWindow.cpp (1 of 2 files). Show all
Unified · Split
| @@ -69,7 +69,6 @@ void interactiveWindowPointerFromScriptValue(const QScriptValue& object, Interac · 68 unmodified lines | |||
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | InteractiveWindow::InteractiveWindow(const QString& sourceUrl, const QVariantMap& properties) { | 71 | InteractiveWindow::InteractiveWindow(const QString& sourceUrl, const QVariantMap& properties) { |
| 72 | bool docked = false; | ||
| 73 | InteractiveWindowPresentationMode presentationMode = InteractiveWindowPresentationMode::Native; | 72 | InteractiveWindowPresentationMode presentationMode = InteractiveWindowPresentationMode::Native; |
| 74 | 73 | ||
| 75 | if (properties.contains(PRESENTATION_MODE_PROPERTY)) { | 74 | if (properties.contains(PRESENTATION_MODE_PROPERTY)) { |
| @@ -124,12 +123,12 @@ InteractiveWindow::InteractiveWindow(const QString& sourceUrl, const QVariantMap · 48 unmodified lines | |||
| 124 | QObject::connect(quickView.get(), &QQuickView::statusChanged, [&, this] (QQuickView::Status status) { | 123 | QObject::connect(quickView.get(), &QQuickView::statusChanged, [&, this] (QQuickView::Status status) { |
| 125 | if (status == QQuickView::Ready) { | 124 | if (status == QQuickView::Ready) { |
| 126 | QQuickItem* rootItem = _dockWidget->getRootItem(); | 125 | QQuickItem* rootItem = _dockWidget->getRootItem(); |
| 126 | _dockWidget->getQuickView()->rootContext()->setContextProperty(EVENT_BRIDGE_PROPERTY, this); | ||
| 127 | QObject::connect(rootItem, SIGNAL(sendToScript(QVariant)), this, SLOT(qmlToScript(const QVariant&)), Qt::QueuedConnection); | 127 | QObject::connect(rootItem, SIGNAL(sendToScript(QVariant)), this, SLOT(qmlToScript(const QVariant&)), Qt::QueuedConnection); |
| 128 | } | 128 | } |
| 129 | }); | 129 | }); |
| 130 | _dockWidget->setSource(QUrl(sourceUrl)); | 130 | _dockWidget->setSource(QUrl(sourceUrl)); |
| 131 | mainWindow->addDockWidget(dockArea, _dockWidget.get()); | 131 | mainWindow->addDockWidget(dockArea, _dockWidget.get()); |
| 132 | _dockedWindow = docked; | ||
| 133 | } else { | 132 | } else { |
| 134 | auto offscreenUi = DependencyManager::get<OffscreenUi>(); | 133 | auto offscreenUi = DependencyManager::get<OffscreenUi>(); |
| 135 | // Build the event bridge and wrapper on the main thread | 134 | // Build the event bridge and wrapper on the main thread |
| @@ -188,10 +187,10 @@ InteractiveWindow::~InteractiveWindow() { · 52 unmodified lines | |||
| 188 | 187 | ||
| 189 | void InteractiveWindow::sendToQml(const QVariant& message) { | 188 | void InteractiveWindow::sendToQml(const QVariant& message) { |
| 190 | // Forward messages received from the script on to QML | 189 | // Forward messages received from the script on to QML |
| 191 | if (_dockedWindow) { | 190 | if (_dockWidget) { |
| 192 | QQuickItem* rootItem = _dockWidget->getRootItem(); | 191 | QQuickItem* rootItem = _dockWidget->getRootItem(); |
| 193 | if (rootItem) { | 192 | if (rootItem) { |
| 194 | QMetaObject::invokeMethod(_qmlWindow, "fromScript", Qt::QueuedConnection, Q_ARG(QVariant, message)); | 193 | QMetaObject::invokeMethod(rootItem, "fromScript", Qt::QueuedConnection, Q_ARG(QVariant, message)); |
| 195 | } | 194 | } |
| 196 | } else { | 195 | } else { |
| 197 | QMetaObject::invokeMethod(_qmlWindow, "fromScript", Qt::QueuedConnection, Q_ARG(QVariant, message)); | 196 | QMetaObject::invokeMethod(_qmlWindow, "fromScript", Qt::QueuedConnection, Q_ARG(QVariant, message)); |