Skip to main content

PSTHState

PSTHState

State class for PSTHWidget. More…

#include <PSTHState.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 styleChanged(PSTHStyle style)
Emitted when plot style changes.
void estimationParamsChanged()
Emitted when estimation parameters change.
void scalingChanged(Neuralyzer::Plots::ScalingMode mode)
Emitted when scaling/normalization mode changes.
void backgroundColorChanged(QString const & hex_color)
Emitted when the plot background color changes.
void viewStateChanged()
Emitted when view state changes (zoom, pan, or bounds).

Public Functions

Name
PSTHState(QObject * parent =[nullptr])
Construct a new PSTHState.
~PSTHState() 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.
VerticalAxisState * verticalAxisState()
Get the vertical axis state object.
void addPlotEvent(QString const & event_name, QString const & event_key)
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< PSTHEventOptions > getPlotEventOptions(QString const & event_name) const
Get options for a specific plot event.
void updatePlotEventOptions(QString const & event_name, PSTHEventOptions const & options)
Update options for a specific plot event.
PSTHStyle getStyle() const
Get the plot style.
void setStyle(PSTHStyle style)
Set the plot style.
Neuralyzer::Plots::EstimationParams const & estimationParams() const
Get the estimation parameters.
void setEstimationParams(Neuralyzer::Plots::EstimationParams const & params)
Set the estimation parameters.
Neuralyzer::Plots::ScalingMode scaling() const
Get the scaling/normalization mode.
void setScaling(Neuralyzer::Plots::ScalingMode mode)
Set the scaling/normalization mode.
QString getBackgroundColor() const
Get the OpenGL / export background color.
void setBackgroundColor(QString const & hex_color)
Set the OpenGL / export background color.
CorePlotting::ViewStateData const & viewState() const
Get the current view state.
void setXZoom(double zoom)
Set X-axis zoom. Only emits viewStateChanged().
void setYZoom(double zoom)
Set Y-axis zoom. Only emits viewStateChanged().
void setPan(double x_pan, double y_pan)
Set pan offsets. Only emits viewStateChanged().
void setXBounds(double x_min, double x_max)
Set data bounds. Emits viewStateChanged() AND stateChanged().
void setYBounds(double y_min, double y_max)
Set Y-axis data bounds and keep in sync with vertical axis state.
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 PSTHState;

State class for PSTHWidget.

PSTHState is the Qt wrapper around PSTHStateData that provides typed accessors and Qt signals for all state properties.

PSTHState 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 styleChanged

void styleChanged(
    PSTHStyle style
)

Emitted when plot style changes.

Parameters:

  • style New plot style

signal estimationParamsChanged

void estimationParamsChanged()

Emitted when estimation parameters change.

signal scalingChanged

void scalingChanged(
    Neuralyzer::Plots::ScalingMode mode
)

Emitted when scaling/normalization mode changes.

Parameters:

  • mode New scaling mode

signal backgroundColorChanged

void backgroundColorChanged(
    QString const & hex_color
)

Emitted when the plot background color changes.

Parameters:

  • hex_color New hex color

signal viewStateChanged

void viewStateChanged()

Emitted when view state changes (zoom, pan, or bounds).

Public Functions Documentation

function PSTHState

explicit PSTHState(
    QObject * parent =nullptr
)

Construct a new PSTHState.

Parameters:

  • parent Parent QObject (typically nullptr, managed by WorkspaceManager)

function ~PSTHState

~PSTHState() override =default

function getTypeName

inline virtual QString getTypeName() const override

Get the type name for this state.

Return: “PSTH”

Reimplements: EditorState::getTypeName

function getDisplayName

virtual QString getDisplayName() const override

Get the display name for UI.

Return: User-visible name (default: “PSTH Plot”)

Reimplements: EditorState::getDisplayName

function setDisplayName

virtual void setDisplayName(
    QString const & name
) override

Set the display name.

Parameters:

  • name New display name

Reimplements: EditorState::setDisplayName

function getAlignmentEventKey

QString getAlignmentEventKey() const

Get 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() const

Get 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() const

Get 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() const

Get 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 verticalAxisState

inline VerticalAxisState * verticalAxisState()

Get the vertical axis state object.

Return: Pointer to the vertical axis state

function addPlotEvent

void addPlotEvent(
    QString const & event_name,
    QString const & event_key
)

Add an event to the plot.

Parameters:

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() const

Get all plot event names.

Return: List of event names currently in the plot

function getPlotEventOptions

std::optional< PSTHEventOptions > getPlotEventOptions(
    QString const & event_name
) const

Get 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 updatePlotEventOptions

void updatePlotEventOptions(
    QString const & event_name,
    PSTHEventOptions const & options
)

Update options for a specific plot event.

Parameters:

  • event_name Name/key of the event
  • options New options

function getStyle

PSTHStyle getStyle() const

Get the plot style.

Return: Current plot style (Bar or Line)

function setStyle

void setStyle(
    PSTHStyle style
)

Set the plot style.

Parameters:

  • style New plot style

function estimationParams

Neuralyzer::Plots::EstimationParams const & estimationParams() const

Get the estimation parameters.

Return: Estimation parameters (BinningParams, GaussianKernelParams, etc.)

function setEstimationParams

void setEstimationParams(
    Neuralyzer::Plots::EstimationParams const & params
)

Set the estimation parameters.

Parameters:

  • params New estimation parameters

function scaling

Neuralyzer::Plots::ScalingMode scaling() const

Get the scaling/normalization mode.

Return: Current scaling mode

function setScaling

void setScaling(
    Neuralyzer::Plots::ScalingMode mode
)

Set the scaling/normalization mode.

Parameters:

  • mode New scaling mode

function getBackgroundColor

QString getBackgroundColor() const

Get the OpenGL / export background color.

Return: Hex color string (e.g. “#1A1A1A”)

function setBackgroundColor

void setBackgroundColor(
    QString const & hex_color
)

Set the OpenGL / export background color.

Parameters:

  • hex_color CSS-style hex color (e.g. “#RRGGBB”)

function viewState

inline CorePlotting::ViewStateData const & viewState() const

Get the current view state.

function setXZoom

void setXZoom(
    double zoom
)

Set X-axis zoom. Only emits viewStateChanged().

function setYZoom

void setYZoom(
    double zoom
)

Set Y-axis zoom. Only emits viewStateChanged().

function setPan

void setPan(
    double x_pan,
    double y_pan
)

Set pan offsets. Only emits viewStateChanged().

function setXBounds

void setXBounds(
    double x_min,
    double x_max
)

Set data bounds. Emits viewStateChanged() AND stateChanged().

function setYBounds

void setYBounds(
    double y_min,
    double y_max
)

Set Y-axis data bounds and keep in sync with vertical axis state.

Parameters:

  • y_min Lower Y bound
  • y_max Upper Y bound

function toJson

virtual std::string toJson() const override

Serialize state to JSON.

Return: JSON string representation

Reimplements: EditorState::toJson

function fromJson

virtual bool fromJson(
    std::string const & json
) override

Restore 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