feat(dialog): WidgetData setListItemColors / listItemColors#119
Merged
Conversation
5 tasks
9c8d078 to
963ab22
Compare
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.
963ab22 to
1b79f1f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a per-item foreground-color channel to the
WidgetDatadialog protocol so plugins can color entries inside a host-renderedQListWidget. The Filter Editor toolbox uses it to paint each entry of its source-curve picker list in the same color as the corresponding line on the plot — letting the user pick a curve by color instead of by name.What
setListItemColorsis for (and what it isn't)This addition colors items inside the dialog's
QListWidget(the source-curve picker on the left panel of the Filter Editor). It is the channel the plugin uses to push a per-item color intoWidgetDataso the host can apply it to theQListWidgetItemwhen rendering.It is not the path that colors the derived curve that lands on the plot after Save — that is plot-side logic and lives in
pj_appdirectly (PlotWidget::addCurve(name, color)and friends), not in the dialog protocol.QDialogpj_dialog_hostreadingWidgetData::listItemColorssetListItemColors← this PRpj_appviaPlotWidget::addCurve(name, QColor)Why the setter has to live in the plugin (and not be host-derived)
The host renders a generic
QListWidget— it has no semantic knowledge of what the list contains. Lists in PJ dialogs can be curves, topics, transform IDs, frequency bins, file paths, etc. Only the plugin knows that entry #3 of this list maps to the curve/imu/orientation/wand that that curve is red in the plot.The plugin gets the curve→color information from the host when the dialog is launched, then writes it back into
WidgetDataviasetListItemColors. The host reads it vialistItemColorsand applies it on render. Standard plugin↔host pattern, mirroring the existingsetListItems/listItemschannel on the same struct.Why it matters (UX)
/imu/orientation/{w,x,y,z}, etc.) the color is the only discriminator that scales beyond two or three items.ABI
std::optional<std::vector<std::string>>) onWidgetData, accessed through the matching getter onWidgetDataView.Generalization
The channel is generic. Any dialog plugin that shows a list of items with an associated semantic color benefits without further protocol changes (FFT picker per-channel, quaternion source picker, future toolboxes).
History
Downstream consumer
view.listItemColors(name)to color the picker list, and the CI on that PR is currently red until this lands and the SDK Conan package is bumped.Test plan
widget_data_view_teststill passes.