History

Merge pull request #10118 from hyperlogic/bug-fix/tablet-restart-scripts

Fix broken eventBridge on tablet after Reload All Scripts.

Seth Alves committed 9 years ago

Commit b0b21402 parents b0fa784 8ff457a6 files · +87 −45Browse files

Showing the changes to libraries/script-engine/src/TabletScriptingInterface.cpp (1 of 6 files). Show all

Unified · Split

libraries/script-engine/src/TabletScriptingInterface.cpp+8−4
@@ -201,7 +201,7 @@ void TabletProxy::setToolbarMode(bool toolbarMode) { · 200 unmodified lines
201 201
202 QObject::connect(quickItem, SIGNAL(windowClosed()), this, SLOT(desktopWindowClosed()));202 QObject::connect(quickItem, SIGNAL(windowClosed()), this, SLOT(desktopWindowClosed()));
203 203
204 QObject::connect(tabletRootWindow, SIGNAL(webEventReceived(QVariant)), this, SIGNAL(webEventReceived(QVariant)));204 QObject::connect(tabletRootWindow, SIGNAL(webEventReceived(QVariant)), this, SLOT(emitWebEvent(QVariant)), Qt::DirectConnection);
205 205
206 // forward qml surface events to interface js206 // forward qml surface events to interface js
207 connect(tabletRootWindow, &QmlWindowClass::fromQml, this, &TabletProxy::fromQml);207 connect(tabletRootWindow, &QmlWindowClass::fromQml, this, &TabletProxy::fromQml);
@@ -271,12 +271,17 @@ bool TabletProxy::isMessageDialogOpen() { · 63 unmodified lines
271 return false;271 return false;
272}272}
273 273
274void TabletProxy::emitWebEvent(QVariant msg) {
275 emit webEventReceived(msg);
276}
277
274void TabletProxy::setQmlTabletRoot(QQuickItem* qmlTabletRoot, QObject* qmlOffscreenSurface) {278void TabletProxy::setQmlTabletRoot(QQuickItem* qmlTabletRoot, QObject* qmlOffscreenSurface) {
275 std::lock_guard<std::mutex> guard(_mutex);279 std::lock_guard<std::mutex> guard(_mutex);
276 _qmlOffscreenSurface = qmlOffscreenSurface;280 _qmlOffscreenSurface = qmlOffscreenSurface;
277 _qmlTabletRoot = qmlTabletRoot;281 _qmlTabletRoot = qmlTabletRoot;
278 if (_qmlTabletRoot && _qmlOffscreenSurface) {282 if (_qmlTabletRoot && _qmlOffscreenSurface) {
279 QObject::connect(_qmlOffscreenSurface, SIGNAL(webEventReceived(QVariant)), this, SIGNAL(webEventReceived(QVariant)));283
284 QObject::connect(_qmlOffscreenSurface, SIGNAL(webEventReceived(QVariant)), this, SLOT(emitWebEvent(QVariant)), Qt::DirectConnection);
280 285
281 // forward qml surface events to interface js286 // forward qml surface events to interface js
282 connect(dynamic_cast<OffscreenQmlSurface*>(_qmlOffscreenSurface), &OffscreenQmlSurface::fromQml, [this](QVariant message) {287 connect(dynamic_cast<OffscreenQmlSurface*>(_qmlOffscreenSurface), &OffscreenQmlSurface::fromQml, [this](QVariant message) {
@@ -398,7 +403,7 @@ void TabletProxy::popFromStack() { · 115 unmodified lines
398 auto stack = _desktopWindow->asQuickItem()->findChild<QQuickItem*>("stack");403 auto stack = _desktopWindow->asQuickItem()->findChild<QQuickItem*>("stack");
399 if (stack) {404 if (stack) {
400 QMetaObject::invokeMethod(stack, "popSource");405 QMetaObject::invokeMethod(stack, "popSource");
401 } else { 406 } else {
402 qCDebug(scriptengine) << "tablet cannot pop QML because _desktopWindow doesn't have child stack";407 qCDebug(scriptengine) << "tablet cannot pop QML because _desktopWindow doesn't have child stack";
403 }408 }
404 } else {409 } else {
@@ -708,4 +713,3 @@ void TabletButtonProxy::editProperties(QVariantMap properties) { · 303 unmodified lines
708}713}
709 714
710#include "TabletScriptingInterface.moc"715#include "TabletScriptingInterface.moc"
711