Skip to content

WebAccess: expose Virtual Console widget hierarchy and parent relationships#1897

Open
mccartyp wants to merge 2 commits intomcallegari:masterfrom
mccartyp:vc-widget-hierarchy
Open

WebAccess: expose Virtual Console widget hierarchy and parent relationships#1897
mccartyp wants to merge 2 commits intomcallegari:masterfrom
mccartyp:vc-widget-hierarchy

Conversation

@mccartyp
Copy link
Copy Markdown
Contributor

Description

Summary of Changes:

This pull request introduces two new additive WebAccess WebSocket API commands that expose the containment hierarchy of Virtual Console widgets:

  • QLC+API|getWidgetParent|
  • QLC+API|getWidgetHierarchy

These APIs allow external integrations to determine how Virtual Console widgets are grouped within frames and nested frames, mirroring the actual VC layout.

Until now, WebAccess exposed widget IDs, captions, and types, but not parent-child relationships. As a result, external controllers and automation software had no reliable way to group widgets by frame, resolve widget context, or reflect the Virtual Console structure accurately.

The new endpoints address this gap by exposing immediate parent relationships and the full widget hierarchy in a deterministic, depth-agnostic way.

New API Commands:

  1. getWidgetParent

QLC+API|getWidgetParent|

Returns the immediate Virtual Console parent container for a widget.

Response format:
QLC+API|getWidgetParent|||

A parentId of 0 with type VirtualConsole indicates a top-level widget.

  1. getWidgetHierarchy

QLC+API|getWidgetHierarchy

Returns a flat edge list describing all parent-child relationships between Virtual Console widgets, including widget IDs, types, and captions. This allows clients to reconstruct the full nested frame hierarchy with arbitrary depth.

Both APIs derive hierarchy by walking the Qt QWidget parent chain and selecting the nearest VCWidget ancestor, making the implementation depth-agnostic and robust to nested frames.

These changes are strictly additive and do not modify any existing WebAccess commands or response formats.

Related Issues:

This change was motivated by external integration requirements and does not correspond to an existing tracked issue.


Checklist

  • I have read and followed the QLC+ Coding Guidelines (https://github.com/mcallegari/qlcplus/wiki/Coding-guidelines).
  • My code adheres to the project's coding style, including:
    • Placing opening braces { on a new line for functions and class definitions.
    • Consistent use of spaces and indentation.
  • I have tested my changes on the following platforms:
    • Linux
    • Windows
    • macOS
  • I have added or updated documentation as necessary.

Testing

Test Cases:

  • Verified WebAccess WebSocket connectivity against a running QLC+ instance.
  • Queried getWidgetsList to obtain active Virtual Console widget IDs.
  • Queried getWidgetParent| for widgets at different nesting levels.
  • Queried getWidgetHierarchy and reconstructed the widget tree client-side.
  • Validated correct handling of:
    • Top-level widgets
    • Widgets nested inside frames
    • Widgets nested inside multiple levels of frames

Test Results:

  • Parent-child relationships matched the Virtual Console layout.
  • Nested frames were represented correctly with arbitrary depth.
  • Root-level widgets consistently returned parentId = 0.
  • No regressions observed in existing WebAccess functionality.

Additional Notes

  • The hierarchy is returned as a flat edge list to keep the protocol simple and extensible.
  • Deterministic ordering is used to ensure stable client-side presentation.
  • These APIs enable external integrations (e.g. control surfaces and automation software) to group widgets by frame, disambiguate context, and mirror the Virtual Console structure accurately.

…nships

Add new WebAccess WebSocket API commands to expose the containment hierarchy
of Virtual Console widgets.

This change introduces two additive API calls:

  - QLC+API|getWidgetParent|<widgetId>
    Returns the immediate Virtual Console parent container for a widget,
    or the Virtual Console root if the widget is top-level.

  - QLC+API|getWidgetHierarchy
    Returns a flat edge list describing the full parent-child relationships
    of all Virtual Console widgets, including widget IDs, types, and captions.

The hierarchy is derived by walking the Qt QWidget parent chain and selecting
the nearest VCWidget ancestor, making the implementation depth-agnostic and
supporting arbitrarily nested frames and solo frames.

Root-level widgets are represented with a parent ID of 0 and a parent type of
"VirtualConsole". Widgets without a valid VC parent or that cannot be resolved
are handled gracefully.

The output is returned in a deterministic order to ensure stable client-side
presentation and minimize UI jitter for external integrations.

These APIs are strictly additive and do not modify any existing WebAccess
commands or response formats. They enable external controllers and automation
software to accurately mirror the Virtual Console layout and resolve widget
grouping and context without requiring workspace parsing.
….html

Extend the WebAccess test page with UI entries for the new
getWidgetParent and getWidgetHierarchy WebSocket commands.

This allows developers and integrators to manually verify Virtual
Console widget parent relationships and full widget hierarchy data
using the standard Test_Web_API.html interface.

No changes to existing APIs or test behaviors.
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 34.224% (-0.001%) from 34.225%
when pulling c9d6c98 on mccartyp:vc-widget-hierarchy
into 59ef0b8 on mcallegari:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants