DataSynthesizer Widget
Overview
The DataSynthesizer_Widget provides a dockable GUI panel for generating synthetic data into DataManager. It uses the DataSynthesizer library’s GeneratorRegistry to access available generators and their parameter schemas, and renders generator-specific parameter forms via AutoParamWidget.
Architecture
The widget follows the standard EditorState pattern with a view + properties split:
DataSynthesizer_Widget/
├── CMakeLists.txt
├── DataSynthesizerWidgetRegistration.hpp/cpp # EditorRegistry registration
├── Core/
│ ├── DataSynthesizerStateData.hpp # reflect-cpp POD struct
│ └── DataSynthesizerState.hpp/cpp # EditorState subclass
└── UI/
├── DataSynthesizerProperties_Widget.hpp/cpp # Properties panel (right zone)
├── DataSynthesizerView_Widget.hpp/cpp # View panel hosting preview
└── SynthesizerPreviewWidget.hpp/cpp # OpenGL polyline preview
State (DataSynthesizerState)
EditorState subclass tracking:
instance_id— unique widget instance identifierdisplay_name— user-visible name (“Data Synthesizer”)output_type— selected output data type (e.g. “AnalogTimeSeries”)generator_name— selected generator registry key (e.g. “SineWave”)parameter_json— current parameter values as JSONoutput_key— DataManager key for generated datatime_key— TimeFrame association (default: “time”)
Implements toJson() / fromJson() via reflect-cpp for workspace persistence. Emits signals (outputTypeChanged, generatorNameChanged, parameterJsonChanged, outputKeyChanged) on state changes.
Properties Widget
Provides the full generator configuration UI:
- Output Type combo — populated from
GeneratorRegistry::listOutputTypes(). Changing this filters the generator combo. - Generator combo — populated from
GeneratorRegistry::listGenerators(output_type). Changing this:- Fetches the
ParameterSchemafrom the registry - Creates a new
AutoParamWidgetform with the schema - Resets
parameter_jsonin state
- Fetches the
- AutoParamWidget — dynamically generated parameter form. Changes update
parameter_jsonin state. - Output key —
QLineEditfor the DataManager key. - Preview button — calls
GeneratorRegistry::generate()directly (no DataManager involvement). If the result is anAnalogTimeSeries, emitspreviewRequested(series)which the view widget receives via a signal/slot connection established in registration. - Generate button — constructs and executes a
SynthesizeDatacommand to commit data to DataManager.
View Widget
Hosts a SynthesizerPreviewWidget (a QOpenGLWidget subclass) that renders a generated AnalogTimeSeries as an OpenGL polyline. The preview is ephemeral — it exists only in the widget, not in DataManager.
SynthesizerPreviewWidget
- Inherits from
QOpenGLWidget+QOpenGLFunctions - Uses
PlottingOpenGL::SceneRendererfor rendering andCorePlotting::SceneBuilderfor scene construction setData(shared_ptr<AnalogTimeSeries>)computes data bounds, builds an orthographic projection with 10% vertical padding, maps values viaTimeSeriesMapper::mapAnalogSeriesFull()with identity layout, and uploads a single polyline batchclearData()clears the scene and repaints- Non-interactive — no pan, zoom, or selection
Registration
Registered via DataSynthesizerWidgetModule::registerTypes() with:
- Type ID:
"DataSynthesizerWidget" - Menu path: View/Tools (also accessible from Modules menu)
- Zone: Right (both view and properties)
- Single instance:
allow_multiple = false - Uses
create_editor_customfor coordinated view + properties creation - Connects
DataSynthesizerProperties_Widget::previewRequestedsignal toDataSynthesizerView_Widget::setPreviewDataslot
State ↔︎ UI Synchronization
- UI → State: Combo/field changes call the corresponding state setter.
AutoParamWidget::parametersChangedupdatesparameter_json. - State → UI (restore):
fromJson()emits all change signals. The properties widget listens to these and repopulates combos, recreatesAutoParamWidgetwith stored schema, and callsfromJson()with storedparameter_json. - A
_restoringguard prevents recursive updates during state restoration.
Dependencies
Qt6::Widgets— UI componentsQt6::OpenGL,Qt6::OpenGLWidgets— OpenGL preview renderingEditorState— state management and registrationDataManager— data storage targetreflectcpp— state serializationAutoParamWidget— dynamic parameter form generationDataSynthesizer— generator registry and executionParameterSchema— schema extractionCommands—SynthesizeDatacommand executionPlottingOpenGL—SceneRendererfor GPU renderingCorePlotting—SceneBuilder,TimeSeriesMapper,SeriesLayout
See Also
- GeneratorRegistry — the generator registry API
- ROADMAP — full development roadmap including Milestone 2c