MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / dispatchPointer

Method dispatchPointer

app/src/UI/Widgets/Painter.cpp:463–487  ·  view source on GitHub ↗

* @brief Invokes a pointer-event JS callback under the watchdog and repaints on success. */

Source from the content-addressed store, hash-verified

461 * @brief Invokes a pointer-event JS callback under the watchdog and repaints on success.
462 */
463void Widgets::Painter::dispatchPointer(QJSValue& fn, const QJSValueList& args)
464{
465 if (!m_runtimeOk || !fn.isCallable())
466 return;
467
468 if (!m_previewMode) {
469 const auto* dashboard = &UI::Dashboard::instance();
470 if (m_index < 0 || m_index >= dashboard->widgetCount(SerialStudio::DashboardPainter)) {
471 m_bridge->setGroup(nullptr);
472 return;
473 }
474
475 m_bridge->setGroup(&dashboard->getGroupWidget(SerialStudio::DashboardPainter, m_index));
476 }
477
478 auto r = m_watchdog.call(fn, args);
479 if (r.isError()) [[unlikely]] {
480 setLastError(QStringLiteral("input: ") + r.property(QStringLiteral("message")).toString());
481 setRuntimeOk(false);
482 return;
483 }
484
485 renderFrame();
486 update();
487}
488
489//--------------------------------------------------------------------------------------------------
490// Pointer input -> JS callbacks

Callers

nothing calls this directly

Calls 5

updateFunction · 0.85
setGroupMethod · 0.80
isErrorMethod · 0.80
widgetCountMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected