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
201201
202202 QObject::connect(quickItem, SIGNAL(windowClosed()), this, SLOT(desktopWindowClosed()));
203203
204− QObject::connect(tabletRootWindow, SIGNAL(webEventReceived(QVariant)), this, SIGNAL(webEventReceived(QVariant)));
204+ QObject::connect(tabletRootWindow, SIGNAL(webEventReceived(QVariant)), this, SLOT(emitWebEvent(QVariant)), Qt::DirectConnection);
205205
206206 // forward qml surface events to interface js
207207 connect(tabletRootWindow, &QmlWindowClass::fromQml, this, &TabletProxy::fromQml);
@@ -271,12 +271,17 @@ bool TabletProxy::isMessageDialogOpen() { · 63 unmodified lines
271271 return false;
272272 }
273273
274+void TabletProxy::emitWebEvent(QVariant msg) {
275+ emit webEventReceived(msg);
276+}
277+
274278 void TabletProxy::setQmlTabletRoot(QQuickItem* qmlTabletRoot, QObject* qmlOffscreenSurface) {
275279 std::lock_guard<std::mutex> guard(_mutex);
276280 _qmlOffscreenSurface = qmlOffscreenSurface;
277281 _qmlTabletRoot = qmlTabletRoot;
278282 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);
280285
281286 // forward qml surface events to interface js
282287 connect(dynamic_cast<OffscreenQmlSurface*>(_qmlOffscreenSurface), &OffscreenQmlSurface::fromQml, [this](QVariant message) {
@@ -398,7 +403,7 @@ void TabletProxy::popFromStack() { · 115 unmodified lines
398403 auto stack = _desktopWindow->asQuickItem()->findChild<QQuickItem*>("stack");
399404 if (stack) {
400405 QMetaObject::invokeMethod(stack, "popSource");
401− } else {
406+ } else {
402407 qCDebug(scriptengine) << "tablet cannot pop QML because _desktopWindow doesn't have child stack";
403408 }
404409 } else {
@@ -708,4 +713,3 @@ void TabletButtonProxy::editProperties(QVariantMap properties) { · 303 unmodified lines
708713 }
709714
710715 #include "TabletScriptingInterface.moc"
711−