EventPlotState
EventPlotState
State class for EventPlotWidget. More…
#include <EventPlotState.hpp>
Inherits from EditorState, QObject
Public Signals
| Name | |
|---|---|
| void | alignmentEventKeyChanged(QString const & key) Emitted when alignment event key changes. |
| void | intervalAlignmentTypeChanged(IntervalAlignmentType type) Emitted when interval alignment type changes. |
| void | offsetChanged(double offset) Emitted when offset changes. |
| void | windowSizeChanged(double window_size) Emitted when window size changes. |
| void | plotEventAdded(QString const & event_name) Emitted when a plot event is added. |
| void | plotEventRemoved(QString const & event_name) Emitted when a plot event is removed. |
| void | plotEventOptionsChanged(QString const & event_name) Emitted when plot event options are updated. |
| void | viewStateChanged() Emitted when any view state property changes (zoom, pan, bounds). |
| void | axisOptionsChanged() Emitted when axis options change. |
| void | backgroundColorChanged(QString const & hex_color) Emitted when background color changes. |
| void | pinnedChanged(bool pinned) Emitted when pinned state changes. |
| void | sortingModeChanged(TrialSortMode mode) Emitted when trial sorting mode changes. |
| void | glyphStyleChanged() Emitted when the glyph style for any event key changes. |
| void | eventGlyphStyleChanged(QString const & event_name) Emitted when the glyph style for a specific event key changes. |
Public Functions
| Name | |
|---|---|
| EventPlotState(QObject * parent =[nullptr]) Construct a new EventPlotState. |
|
| ~EventPlotState() override =default | |
| virtual QString | getTypeName() const override Get the type name for this state. |
| virtual QString | getDisplayName() const override Get the display name for UI. |
| virtual void | setDisplayName(QString const & name) override Set the display name. |
| QString | getAlignmentEventKey() const Get the alignment event key. |
| void | setAlignmentEventKey(QString const & key) Set the alignment event key. |
| IntervalAlignmentType | getIntervalAlignmentType() const Get the interval alignment type. |
| void | setIntervalAlignmentType(IntervalAlignmentType type) Set the interval alignment type. |
| double | getOffset() const Get the offset value. |
| void | setOffset(double offset) Set the offset value. |
| double | getWindowSize() const Get the window size. |
| void | setWindowSize(double window_size) Set the window size. |
| PlotAlignmentState * | alignmentState() Get the alignment state object. |
| RelativeTimeAxisState * | relativeTimeAxisState() Get the relative time axis state object. |
| CorePlotting::ViewStateData const & | viewState() const Get the view state (zoom, pan, bounds). |
| void | setXZoom(double zoom) Set X-axis zoom factor (view transform only). |
| void | setYZoom(double zoom) Set Y-axis zoom factor (view transform only). |
| void | setPan(double x_pan, double y_pan) Set pan offset (view transform only). |
| void | setXBounds(double x_min, double x_max) Set X-axis data bounds (triggers scene rebuild). |
| EventPlotAxisOptions const & | axisOptions() const Get axis label and grid options. |
| void | setAxisOptions(EventPlotAxisOptions const & options) Set axis options. |
| QString | getBackgroundColor() const Get the background color. |
| void | setBackgroundColor(QString const & hex_color) Set the background color. |
| bool | isPinned() const Check if the widget is pinned. |
| void | setPinned(bool pinned) Set the pinned state. |
| TrialSortMode | getSortingMode() const Get the trial sorting mode. |
| void | setSortingMode(TrialSortMode mode) Set the trial sorting mode. |
| EventPlotStateData const & | data() const Get const reference to underlying data. |
| void | addPlotEvent(QString const & event_name, QString const & event_key, std::optional< IntervalAlignmentType > interval_edge =std::nullopt) Add an event to the plot. |
| void | removePlotEvent(QString const & event_name) Remove an event from the plot. |
| std::vector< QString > | getPlotEventNames() const Get all plot event names. |
| std::optional< EventPlotOptions > | getPlotEventOptions(QString const & event_name) const Get options for a specific plot event. |
| GlyphStyleState * | glyphStyleStateForKey(QString const & event_name) Get the GlyphStyleState for a specific plot event key. |
| CorePlotting::GlyphStyleData | getEventGlyphStyle(QString const & event_name) const Get the serializable glyph style data for a key (read-only). |
| void | updatePlotEventOptions(QString const & event_name, EventPlotOptions const & options) Update options for a specific plot event. |
| virtual std::string | toJson() const override Serialize state to JSON. |
| virtual bool | fromJson(std::string const & json) override Restore state from JSON. |
Additional inherited members
Public Signals inherited from EditorState
| Name | |
|---|---|
| void | stateChanged() Emitted when any state property changes. |
| void | displayNameChanged(QString const & newName) Emitted when display name changes. |
| void | dirtyChanged(bool isDirty) Emitted when dirty state changes. |
Public Functions inherited from EditorState
| Name | |
|---|---|
| EditorState(QObject * parent =[nullptr]) Construct a new EditorState. |
|
| ~EditorState() override =default Virtual destructor. |
|
| QString | getInstanceId() const Get unique instance ID. |
| bool | isDirty() const Check if state has unsaved changes. |
| void | markClean() Mark state as clean (after save). |
Protected Functions inherited from EditorState
| Name | |
|---|---|
| void | markDirty() Mark state as modified. |
| void | setInstanceId(QString const & id) Set instance ID (for deserialization). |
| QString | generateInstanceId() Generate a new unique instance ID. |
Detailed Description
class EventPlotState;State class for EventPlotWidget.
EventPlotState is the Qt wrapper around EventPlotStateData that provides typed accessors and Qt signals for all state properties.
EventPlotState uses composition with PlotAlignmentState to provide alignment functionality via the shared PlotAlignmentWidget component.
Public Signals Documentation
signal alignmentEventKeyChanged
void alignmentEventKeyChanged(
QString const & key
)Emitted when alignment event key changes.
Parameters:
- key New alignment event key
signal intervalAlignmentTypeChanged
void intervalAlignmentTypeChanged(
IntervalAlignmentType type
)Emitted when interval alignment type changes.
Parameters:
- type New interval alignment type
signal offsetChanged
void offsetChanged(
double offset
)Emitted when offset changes.
Parameters:
- offset New offset value
signal windowSizeChanged
void windowSizeChanged(
double window_size
)Emitted when window size changes.
Parameters:
- window_size New window size value
signal plotEventAdded
void plotEventAdded(
QString const & event_name
)Emitted when a plot event is added.
Parameters:
- event_name Name of the added event
signal plotEventRemoved
void plotEventRemoved(
QString const & event_name
)Emitted when a plot event is removed.
Parameters:
- event_name Name of the removed event
signal plotEventOptionsChanged
void plotEventOptionsChanged(
QString const & event_name
)Emitted when plot event options are updated.
Parameters:
- event_name Name of the updated event
signal viewStateChanged
void viewStateChanged()Emitted when any view state property changes (zoom, pan, bounds).
This is a consolidated signal for all view state changes. Connect to this for re-rendering the OpenGL view.
signal axisOptionsChanged
void axisOptionsChanged()Emitted when axis options change.
signal backgroundColorChanged
void backgroundColorChanged(
QString const & hex_color
)Emitted when background color changes.
Parameters:
- hex_color New background color as hex string
signal pinnedChanged
void pinnedChanged(
bool pinned
)Emitted when pinned state changes.
Parameters:
- pinned New pinned state
signal sortingModeChanged
void sortingModeChanged(
TrialSortMode mode
)Emitted when trial sorting mode changes.
Parameters:
- mode New sorting mode
signal glyphStyleChanged
void glyphStyleChanged()Emitted when the glyph style for any event key changes.
signal eventGlyphStyleChanged
void eventGlyphStyleChanged(
QString const & event_name
)Emitted when the glyph style for a specific event key changes.
Parameters:
- event_name Name of the event whose style changed
Public Functions Documentation
function EventPlotState
explicit EventPlotState(
QObject * parent =nullptr
)Construct a new EventPlotState.
Parameters:
- parent Parent QObject (typically nullptr, managed by WorkspaceManager)
function ~EventPlotState
~EventPlotState() override =defaultfunction getTypeName
inline virtual QString getTypeName() const overrideGet the type name for this state.
Return: “EventPlot”
Reimplements: EditorState::getTypeName
function getDisplayName
virtual QString getDisplayName() const overrideGet the display name for UI.
Return: User-visible name (default: “Event Plot”)
Reimplements: EditorState::getDisplayName
function setDisplayName
virtual void setDisplayName(
QString const & name
) overrideSet the display name.
Parameters:
- name New display name
Reimplements: EditorState::setDisplayName
function getAlignmentEventKey
QString getAlignmentEventKey() constGet the alignment event key.
Return: Key of the selected event/interval series
function setAlignmentEventKey
void setAlignmentEventKey(
QString const & key
)Set the alignment event key.
Parameters:
- key Key of the event/interval series to use for alignment
function getIntervalAlignmentType
IntervalAlignmentType getIntervalAlignmentType() constGet the interval alignment type.
Return: Whether to use beginning or end of intervals
function setIntervalAlignmentType
void setIntervalAlignmentType(
IntervalAlignmentType type
)Set the interval alignment type.
Parameters:
- type Whether to use beginning or end of intervals
function getOffset
double getOffset() constGet the offset value.
Return: Offset in time units
function setOffset
void setOffset(
double offset
)Set the offset value.
Parameters:
- offset Offset in time units to apply to alignment events
function getWindowSize
double getWindowSize() constGet the window size.
Return: Window size in time units
function setWindowSize
void setWindowSize(
double window_size
)Set the window size.
Parameters:
- window_size Window size in time units to gather around alignment event
function alignmentState
inline PlotAlignmentState * alignmentState()Get the alignment state object.
Return: Pointer to the alignment state (for use with PlotAlignmentWidget)
function relativeTimeAxisState
inline RelativeTimeAxisState * relativeTimeAxisState()Get the relative time axis state object.
Return: Pointer to the relative time axis state
function viewState
inline CorePlotting::ViewStateData const & viewState() constGet the view state (zoom, pan, bounds).
Return: Const reference to the view state
function setXZoom
void setXZoom(
double zoom
)Set X-axis zoom factor (view transform only).
Parameters:
- zoom Zoom factor (1.0 = full window visible, 2.0 = half visible)
Adjusts magnification without changing the underlying data window. Only emits viewStateChanged(), not stateChanged() - no scene rebuild.
function setYZoom
void setYZoom(
double zoom
)Set Y-axis zoom factor (view transform only).
Parameters:
- zoom Zoom factor (1.0 = all trials fit, 2.0 = half the trials fit)
Adjusts trial density without changing the underlying data. Only emits viewStateChanged(), not stateChanged() - no scene rebuild.
function setPan
void setPan(
double x_pan,
double y_pan
)Set pan offset (view transform only).
Parameters:
- x_pan X-axis pan offset in world units (ms)
- y_pan Y-axis pan offset in normalized units
Shifts the view without changing the underlying data window. Only emits viewStateChanged(), not stateChanged() - no scene rebuild.
function setXBounds
void setXBounds(
double x_min,
double x_max
)Set X-axis data bounds (triggers scene rebuild).
Parameters:
- x_min Minimum time before alignment (typically negative)
- x_max Maximum time after alignment (typically positive)
Changes the window of data gathered from the DataManager. Emits both viewStateChanged() AND stateChanged() - triggers scene rebuild.
function axisOptions
inline EventPlotAxisOptions const & axisOptions() constGet axis label and grid options.
Return: Const reference to axis options
function setAxisOptions
void setAxisOptions(
EventPlotAxisOptions const & options
)Set axis options.
Parameters:
- options New axis options
function getBackgroundColor
QString getBackgroundColor() constGet the background color.
Return: Background color as hex string (e.g., “#FFFFFF”)
function setBackgroundColor
void setBackgroundColor(
QString const & hex_color
)Set the background color.
Parameters:
- hex_color Background color as hex string (e.g., “#FFFFFF”)
function isPinned
inline bool isPinned() constCheck if the widget is pinned.
Return: true if pinned (ignores SelectionContext changes)
function setPinned
void setPinned(
bool pinned
)Set the pinned state.
Parameters:
- pinned Whether to ignore SelectionContext changes
function getSortingMode
inline TrialSortMode getSortingMode() constGet the trial sorting mode.
Return: Current trial sorting mode
function setSortingMode
void setSortingMode(
TrialSortMode mode
)Set the trial sorting mode.
Parameters:
- mode New sorting mode
function data
inline EventPlotStateData const & data() constGet const reference to underlying data.
Return: Const reference to EventPlotStateData
function addPlotEvent
void addPlotEvent(
QString const & event_name,
QString const & event_key,
std::optional< IntervalAlignmentType > interval_edge =std::nullopt
)Add an event to the plot.
Parameters:
- event_name Name/key for the event (used as identifier)
- event_key DataManager key of the DigitalEventSeries or DigitalIntervalSeries
- interval_edge Edge to extract when source is an interval series (nullopt for event series)
function removePlotEvent
void removePlotEvent(
QString const & event_name
)Remove an event from the plot.
Parameters:
- event_name Name/key of the event to remove
function getPlotEventNames
std::vector< QString > getPlotEventNames() constGet all plot event names.
Return: List of event names currently in the plot
function getPlotEventOptions
std::optional< EventPlotOptions > getPlotEventOptions(
QString const & event_name
) constGet options for a specific plot event.
Parameters:
- event_name Name/key of the event
Return: Options struct, or std::nullopt if event not found
function glyphStyleStateForKey
GlyphStyleState * glyphStyleStateForKey(
QString const & event_name
)Get the GlyphStyleState for a specific plot event key.
Parameters:
- event_name The event name
Returns nullptr if the key has not been added. The returned pointer is owned by this state and must not be deleted by the caller.
function getEventGlyphStyle
CorePlotting::GlyphStyleData getEventGlyphStyle(
QString const & event_name
) constGet the serializable glyph style data for a key (read-only).
Returns a default style if the key has not been added.
function updatePlotEventOptions
void updatePlotEventOptions(
QString const & event_name,
EventPlotOptions const & options
)Update options for a specific plot event.
Parameters:
- event_name Name/key of the event
- options New options (event_key only; glyph style is managed via GlyphStyleState)
function toJson
virtual std::string toJson() const overrideSerialize state to JSON.
Return: JSON string representation
Reimplements: EditorState::toJson
function fromJson
virtual bool fromJson(
std::string const & json
) overrideRestore state from JSON.
Parameters:
- json JSON string to parse
Return: true if parsing succeeded
Reimplements: EditorState::fromJson
Updated on 2026-11-13 at 20:25:40 +0000