Skip to content

Commit 1b79f1f

Browse files
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.
1 parent 0c3aa51 commit 1b79f1f

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

pj_plugins/dialog_protocol/include/pj_plugins/host/widget_data_view.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ class WidgetDataView {
7575
[[nodiscard]] std::optional<std::vector<std::string>> selectedItems(std::string_view name) const {
7676
return getStringArray(name, "selected_items");
7777
}
78+
[[nodiscard]] std::optional<std::vector<std::string>> listItemColors(std::string_view name) const {
79+
return getStringArray(name, "list_item_colors");
80+
}
7881

7982
// --- QTableWidget ---
8083
[[nodiscard]] std::optional<std::vector<std::string>> tableHeaders(std::string_view name) const {

pj_plugins/dialog_protocol/include/pj_plugins/sdk/widget_data.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,14 @@ class WidgetData {
9393
return *this;
9494
}
9595

96+
// Set foreground colors for QListWidget items, parallel to the items vector
97+
// set by setListItems. Each entry is a CSS color string (e.g. "#ff0000") or
98+
// empty to use the default palette color. Size must match the items vector.
99+
WidgetData& setListItemColors(std::string_view name, const std::vector<std::string>& colors) {
100+
entry(name)["list_item_colors"] = colors;
101+
return *this;
102+
}
103+
96104
// --- QTableWidget ---
97105
WidgetData& setTableHeaders(std::string_view name, const std::vector<std::string>& headers) {
98106
entry(name)["headers"] = headers;

0 commit comments

Comments
 (0)