From 1b79f1fd968fe79ab030dfe99fcb6b4a2982415e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20I=C3=B1igo=20Blasco?= Date: Tue, 9 Jun 2026 13:00:59 +0200 Subject: [PATCH] feat(dialog): WidgetData setListItemColors / listItemColors Add a per-item foreground-color channel to the WidgetData dialog protocol so plugins can color source-list entries to match the curve colors in the plot. The Filter Editor toolbox uses it to render the source-curve list with the same colors as the plot. - widget_data.hpp: setListItemColors(name, colors). - widget_data_view.hpp: listItemColors(name) accessor mirrored on the host side so the dialog engine can read it back when rebuilding the Qt model. ABI: additive, no field reorder, no struct shrink. Existing plugins that do not set the new channel see a default-empty optional and render with the inherited foreground color. No host or plugin recompile needed. Test plan - Existing widget_data_view_test still passes. - Filter Editor (downstream) consumes the new channel; manual smoke shows source-list items in plot colors. --- .../include/pj_plugins/host/widget_data_view.hpp | 3 +++ .../include/pj_plugins/sdk/widget_data.hpp | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/pj_plugins/dialog_protocol/include/pj_plugins/host/widget_data_view.hpp b/pj_plugins/dialog_protocol/include/pj_plugins/host/widget_data_view.hpp index e55bfa4d..4037eccf 100644 --- a/pj_plugins/dialog_protocol/include/pj_plugins/host/widget_data_view.hpp +++ b/pj_plugins/dialog_protocol/include/pj_plugins/host/widget_data_view.hpp @@ -75,6 +75,9 @@ class WidgetDataView { [[nodiscard]] std::optional> selectedItems(std::string_view name) const { return getStringArray(name, "selected_items"); } + [[nodiscard]] std::optional> listItemColors(std::string_view name) const { + return getStringArray(name, "list_item_colors"); + } // --- QTableWidget --- [[nodiscard]] std::optional> tableHeaders(std::string_view name) const { diff --git a/pj_plugins/dialog_protocol/include/pj_plugins/sdk/widget_data.hpp b/pj_plugins/dialog_protocol/include/pj_plugins/sdk/widget_data.hpp index 10ed5a95..4db30cb0 100644 --- a/pj_plugins/dialog_protocol/include/pj_plugins/sdk/widget_data.hpp +++ b/pj_plugins/dialog_protocol/include/pj_plugins/sdk/widget_data.hpp @@ -93,6 +93,14 @@ class WidgetData { return *this; } + // Set foreground colors for QListWidget items, parallel to the items vector + // set by setListItems. Each entry is a CSS color string (e.g. "#ff0000") or + // empty to use the default palette color. Size must match the items vector. + WidgetData& setListItemColors(std::string_view name, const std::vector& colors) { + entry(name)["list_item_colors"] = colors; + return *this; + } + // --- QTableWidget --- WidgetData& setTableHeaders(std::string_view name, const std::vector& headers) { entry(name)["headers"] = headers;