DataViewer_Widget
DataViewer_Widget
#include <DataViewer_Widget.hpp>
Inherits from QWidget
Public Slots
| Name | |
|---|---|
| void | _saveLaneLayout() Save the current lane layout (displayed series + overrides) to a JSON file. |
| void | _loadLaneLayout() Load a previously saved lane layout from a JSON file. |
| void | _loadLaneLayoutFromText(QString const & text) Load a lane layout profile from JSON text. |
| void | _loadSpikeToAnalogPairing() Load spike-to-analog pairing CSV via a file dialog and apply placement overrides. |
| void | _loadSpikeToAnalogPairingFromText(QString const & digital_group, QString const & analog_group, QString const & text, int placement_mode) Parse spike-to-analog CSV text and apply lane placement overrides. |
| void | _handleSeriesRelativePlacement(QString const & source_key, QString const & target_key, bool above) Handle a relative placement request from the properties widget context menu. |
Public Functions
| Name | |
|---|---|
| DataViewer_Widget(std::shared_ptr< DataManager > data_manager, QWidget * parent =[nullptr]) | |
| ~DataViewer_Widget() override | |
| void | openWidget() |
| void | setState(std::shared_ptr< DataViewerState > state) Set the DataViewerState for this widget. |
| std::shared_ptr< DataViewerState > | state() const Get the current DataViewerState (const). |
| DataViewerState * | state() Get mutable state access. |
| OpenGLWidget * | getOpenGLWidget() const Get the OpenGLWidget (for testing). |
| std::string | buildLaneLayoutJson() const Build the current lane layout profile JSON without opening a file dialog. |
| void | autoArrangeVerticalSpacing() Automatically arrange all visible series for optimal spacing. |
| void | exportToSVG(bool includeScalebar, int scalebarLength) Export the current plot to SVG. |
| void | addFeature(std::string const & key, std::string const & color) Add a feature to the plot. |
| void | removeFeature(std::string const & key) Remove a feature from the plot. |
| void | addFeatures(std::vector< std::string > const & keys, std::vector< std::string > const & colors) Add multiple features (batch operation). |
| void | removeFeatures(std::vector< std::string > const & keys) Remove multiple features (batch operation). |
| void | handleColorChanged(std::string const & key, std::string const & hex_color) Handle color change from properties widget. |
| void | showGroupContextMenu(std::string const & group_name, QPoint const & global_pos) Show context menu for a group. |
| void | _onTimeChanged(TimePosition const & position) |
Protected Functions
| Name | |
|---|---|
| void | closeEvent(QCloseEvent * event) override |
| void | wheelEvent(QWheelEvent * event) override |
| void | resizeEvent(QResizeEvent * event) override |
Public Slots Documentation
slot _saveLaneLayout
void _saveLaneLayout()Save the current lane layout (displayed series + overrides) to a JSON file.
Opens a file dialog for the user to choose a destination. Writes all currently-displayed series with their colors and all lane-placement overrides to a .json file that can be restored with _loadLaneLayout().
slot _loadLaneLayout
void _loadLaneLayout()Load a previously saved lane layout from a JSON file.
Opens a file dialog for the user to select a .json file produced by _saveLaneLayout(). Series listed in the file that exist in the DataManager but are not currently displayed are automatically added. Series absent from the DataManager are silently skipped.
slot _loadLaneLayoutFromText
void _loadLaneLayoutFromText(
QString const & text
)Load a lane layout profile from JSON text.
Parameters:
- text Raw lane layout profile JSON
Applies the same profile logic as _loadLaneLayout without opening a file dialog. Series absent from the DataManager are skipped.
slot _loadSpikeToAnalogPairing
void _loadSpikeToAnalogPairing()Load spike-to-analog pairing CSV via a file dialog and apply placement overrides.
Opens [SpikeToAnalogConfigDialog](/api_generated/Classes/classSpikeToAnalogConfigDialog.md) to collect all parse options, group prefixes, placement mode, and CSV file path, then reads the file and delegates to _applyAnalogPairing.
slot _loadSpikeToAnalogPairingFromText
void _loadSpikeToAnalogPairingFromText(
QString const & digital_group,
QString const & analog_group,
QString const & text,
int placement_mode
)Parse spike-to-analog CSV text and apply lane placement overrides.
Parameters:
- digital_group Group prefix for digital spike series (e.g. “spikes_”)
- analog_group Group prefix for analog LFP series (e.g. “voltage_”)
- text Raw CSV content
- placement_mode Cast of SpikeToAnalogPlacementMode to int
Uses the default [SpikeToAnalogParseConfig](/api_generated/Classes/structSpikeToAnalogParseConfig.md) (comma delimiter, columns 2 and 3, 1-based indexing). Exposed as a named slot so that unit tests can invoke it via QMetaObject::invokeMethod without needing to pass a parse config.
slot _handleSeriesRelativePlacement
void _handleSeriesRelativePlacement(
QString const & source_key,
QString const & target_key,
bool above
)Handle a relative placement request from the properties widget context menu.
Parameters:
- source_key Series key to reposition
- target_key Series key to place relative to
- above true = place source above target, false = place below
Places source_key immediately above or below target_key in the visual lane stack by writing deterministic lane_order overrides to DataViewerState.
Public Functions Documentation
function DataViewer_Widget
DataViewer_Widget(
std::shared_ptr< DataManager > data_manager,
QWidget * parent =nullptr
)function ~DataViewer_Widget
~DataViewer_Widget() overridefunction openWidget
void openWidget()function setState
void setState(
std::shared_ptr< DataViewerState > state
)Set the DataViewerState for this widget.
Parameters:
- state Shared pointer to the state object
The state manages all serializable settings including view state, theme, grid settings, UI preferences, and per-series display options. This widget owns the state and shares it with OpenGLWidget.
function state
inline std::shared_ptr< DataViewerState > state() constGet the current DataViewerState (const).
Return: Shared pointer to the state object
function state
DataViewerState * state()Get mutable state access.
Return: Raw pointer to state for modification
function getOpenGLWidget
OpenGLWidget * getOpenGLWidget() constGet the OpenGLWidget (for testing).
Return: Pointer to the internal OpenGLWidget
function buildLaneLayoutJson
std::string buildLaneLayoutJson() constBuild the current lane layout profile JSON without opening a file dialog.
Return: Serialized lane layout profile JSON
Used by tests and by the interactive save path. The returned JSON uses stable lane IDs and event associations instead of exposing derived lane_order values for newly associated event series.
function autoArrangeVerticalSpacing
void autoArrangeVerticalSpacing()Automatically arrange all visible series for optimal spacing.
This function recalculates positioning for all currently visible series to achieve optimal vertical space distribution and prevent overlap.
function exportToSVG
void exportToSVG(
bool includeScalebar,
int scalebarLength
)Export the current plot to SVG.
Parameters:
- includeScalebar Whether to include a scalebar in the export
- scalebarLength Length of the scalebar in time units
Opens a file dialog and exports the plot to an SVG file.
function addFeature
void addFeature(
std::string const & key,
std::string const & color
)Add a feature to the plot.
Parameters:
- key The data key to add
- color The color (hex string) for the feature
Called by the properties widget when a feature is toggled on.
function removeFeature
void removeFeature(
std::string const & key
)Remove a feature from the plot.
Parameters:
- key The data key to remove
Called by the properties widget when a feature is toggled off.
function addFeatures
void addFeatures(
std::vector< std::string > const & keys,
std::vector< std::string > const & colors
)Add multiple features (batch operation).
Parameters:
- keys The data keys to add
- colors The colors (hex strings) for each key (parallel array)
Called by the properties widget when a group is toggled on.
function removeFeatures
void removeFeatures(
std::vector< std::string > const & keys
)Remove multiple features (batch operation).
Parameters:
- keys The data keys to remove
Called by the properties widget when a group is toggled off.
function handleColorChanged
void handleColorChanged(
std::string const & key,
std::string const & hex_color
)Handle color change from properties widget.
Parameters:
- key The data key
- hex_color New color in hex format
function _onTimeChanged
void _onTimeChanged(
TimePosition const & position
)Protected Functions Documentation
function closeEvent
void closeEvent(
QCloseEvent * event
) overridefunction wheelEvent
void wheelEvent(
QWheelEvent * event
) overridefunction resizeEvent
void resizeEvent(
QResizeEvent * event
) overrideUpdated on 2026-11-13 at 20:25:41 +0000