Fix broken eventBridge on tablet after Reload All Scripts.
Showing the changes to libraries/script-engine/src/TabletScriptingInterface.cpp (1 of 6 files). Show all
Unified · Split
| @@ -201,7 +201,7 @@ void TabletProxy::setToolbarMode(bool toolbarMode) { · 200 unmodified lines | ||
| 201 | 201 | |
| 202 | 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 | 206 | // forward qml surface events to interface js |
| 207 | 207 | connect(tabletRootWindow, &QmlWindowClass::fromQml, this, &TabletProxy::fromQml); |
| @@ -271,12 +271,17 @@ bool TabletProxy::isMessageDialogOpen() { · 63 unmodified lines | ||
| 271 | 271 | return false; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | +void TabletProxy::emitWebEvent(QVariant msg) { | |
| 275 | + emit webEventReceived(msg); | |
| 276 | +} | |
| 277 | + | |
| 274 | 278 | void TabletProxy::setQmlTabletRoot(QQuickItem* qmlTabletRoot, QObject* qmlOffscreenSurface) { |
| 275 | 279 | std::lock_guard<std::mutex> guard(_mutex); |
| 276 | 280 | _qmlOffscreenSurface = qmlOffscreenSurface; |
| 277 | 281 | _qmlTabletRoot = qmlTabletRoot; |
| 278 | 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 | 286 | // forward qml surface events to interface js |
| 282 | 287 | connect(dynamic_cast<OffscreenQmlSurface*>(_qmlOffscreenSurface), &OffscreenQmlSurface::fromQml, [this](QVariant message) { |
| @@ -398,7 +403,7 @@ void TabletProxy::popFromStack() { · 115 unmodified lines | ||
| 398 | 403 | auto stack = _desktopWindow->asQuickItem()->findChild<QQuickItem*>("stack"); |
| 399 | 404 | if (stack) { |
| 400 | 405 | QMetaObject::invokeMethod(stack, "popSource"); |
| 401 | − } else { | |
| 406 | + } else { | |
| 402 | 407 | qCDebug(scriptengine) << "tablet cannot pop QML because _desktopWindow doesn't have child stack"; |
| 403 | 408 | } |
| 404 | 409 | } else { |
| @@ -708,4 +713,3 @@ void TabletButtonProxy::editProperties(QVariantMap properties) { · 303 unmodified lines | ||
| 708 | 713 | } |
| 709 | 714 | |
| 710 | 715 | #include "TabletScriptingInterface.moc" |
| 711 | − | |