Skip to main content

OnionSkinViewState

OnionSkinViewState

State class for OnionSkinViewWidget. More…

#include <OnionSkinViewState.hpp>

Inherits from EditorState, QObject

Public Signals

Name
void viewStateChanged()
void pointDataKeyAdded(QString const & key)
void pointDataKeyRemoved(QString const & key)
void pointDataKeysCleared()
void lineDataKeyAdded(QString const & key)
void lineDataKeyRemoved(QString const & key)
void lineDataKeysCleared()
void maskDataKeyAdded(QString const & key)
void maskDataKeyRemoved(QString const & key)
void maskDataKeysCleared()
void windowBehindChanged(int behind)
void windowAheadChanged(int ahead)
void alphaCurveChanged(QString const & curve)
void minAlphaChanged(float alpha)
void maxAlphaChanged(float alpha)
void glyphStyleChanged()
Emitted when the glyph style for any point key changes.
void pointKeyGlyphStyleChanged(QString const & key)
Emitted when the glyph style for a specific point key changes.
void lineStyleChanged()
Emitted when the line style for any line key changes.
void lineKeyLineStyleChanged(QString const & key)
Emitted when the line style for a specific line key changes.
void maskStyleChanged()
Emitted when the mask contour style for any mask key changes.
void maskKeyLineStyleChanged(QString const & key)
Emitted when the mask contour style for a specific mask key changes.
void highlightCurrentChanged(bool highlight)

Public Functions

Name
OnionSkinViewState(QObject * parent =[nullptr])
Construct a new OnionSkinViewState.
~OnionSkinViewState() override =default
virtual QString getTypeName() const override
Get unique type name for this editor state.
virtual QString getDisplayName() const override
Get display name for UI.
virtual void setDisplayName(QString const & name) override
Set display name.
HorizontalAxisState * horizontalAxisState()
VerticalAxisState * verticalAxisState()
CorePlotting::ViewStateData const & viewState() const
Get the current view state (bounds + zoom + pan).
void setXZoom(double zoom)
void setYZoom(double zoom)
void setPan(double x_pan, double y_pan)
void setXBounds(double x_min, double x_max)
Set X data bounds and keep horizontal axis in sync.
void setYBounds(double y_min, double y_max)
Set Y data bounds and keep vertical axis in sync.
std::vector< QString > getPointDataKeys() const
Get all point data keys.
void addPointDataKey(QString const & key)
void removePointDataKey(QString const & key)
void clearPointDataKeys()
std::vector< QString > getLineDataKeys() const
Get all line data keys.
void addLineDataKey(QString const & key)
void removeLineDataKey(QString const & key)
void clearLineDataKeys()
std::vector< QString > getMaskDataKeys() const
Get all mask data keys.
void addMaskDataKey(QString const & key)
void removeMaskDataKey(QString const & key)
void clearMaskDataKeys()
int getWindowBehind() const
void setWindowBehind(int behind)
int getWindowAhead() const
void setWindowAhead(int ahead)
QString getAlphaCurve() const
void setAlphaCurve(QString const & curve)
float getMinAlpha() const
void setMinAlpha(float alpha)
float getMaxAlpha() const
void setMaxAlpha(float alpha)
GlyphStyleState * glyphStyleStateForKey(QString const & key)
Get the GlyphStyleState for a specific point data key.
CorePlotting::GlyphStyleData getPointKeyGlyphStyle(QString const & key) const
Get the serializable glyph style data for a key (read-only).
LineStyleState * lineStyleStateForKey(QString const & key)
Get the LineStyleState for a specific line data key.
CorePlotting::LineStyleData getLineKeyLineStyle(QString const & key) const
Get the serializable line style data for a key (read-only).
LineStyleState * maskStyleStateForKey(QString const & key)
Get the LineStyleState for a specific mask data key.
CorePlotting::LineStyleData getMaskKeyLineStyle(QString const & key) const
Get the serializable mask contour style data for a key (read-only).
bool getHighlightCurrent() const
void setHighlightCurrent(bool highlight)
virtual std::string toJson() const override
Serialize state to JSON string.
virtual bool fromJson(std::string const & json) override
Restore state from JSON string.

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 OnionSkinViewState;

State class for OnionSkinViewWidget.

Single source of truth: view_state (zoom/pan) plus horizontal and vertical axis states (full range), temporal window parameters, alpha curve settings, data keys, and rendering parameters.

Public Signals Documentation

signal viewStateChanged

void viewStateChanged()

signal pointDataKeyAdded

void pointDataKeyAdded(
    QString const & key
)

signal pointDataKeyRemoved

void pointDataKeyRemoved(
    QString const & key
)

signal pointDataKeysCleared

void pointDataKeysCleared()

signal lineDataKeyAdded

void lineDataKeyAdded(
    QString const & key
)

signal lineDataKeyRemoved

void lineDataKeyRemoved(
    QString const & key
)

signal lineDataKeysCleared

void lineDataKeysCleared()

signal maskDataKeyAdded

void maskDataKeyAdded(
    QString const & key
)

signal maskDataKeyRemoved

void maskDataKeyRemoved(
    QString const & key
)

signal maskDataKeysCleared

void maskDataKeysCleared()

signal windowBehindChanged

void windowBehindChanged(
    int behind
)

signal windowAheadChanged

void windowAheadChanged(
    int ahead
)

signal alphaCurveChanged

void alphaCurveChanged(
    QString const & curve
)

signal minAlphaChanged

void minAlphaChanged(
    float alpha
)

signal maxAlphaChanged

void maxAlphaChanged(
    float alpha
)

signal glyphStyleChanged

void glyphStyleChanged()

Emitted when the glyph style for any point key changes.

signal pointKeyGlyphStyleChanged

void pointKeyGlyphStyleChanged(
    QString const & key
)

Emitted when the glyph style for a specific point key changes.

signal lineStyleChanged

void lineStyleChanged()

Emitted when the line style for any line key changes.

signal lineKeyLineStyleChanged

void lineKeyLineStyleChanged(
    QString const & key
)

Emitted when the line style for a specific line key changes.

signal maskStyleChanged

void maskStyleChanged()

Emitted when the mask contour style for any mask key changes.

signal maskKeyLineStyleChanged

void maskKeyLineStyleChanged(
    QString const & key
)

Emitted when the mask contour style for a specific mask key changes.

signal highlightCurrentChanged

void highlightCurrentChanged(
    bool highlight
)

Public Functions Documentation

function OnionSkinViewState

explicit OnionSkinViewState(
    QObject * parent =nullptr
)

Construct a new OnionSkinViewState.

Parameters:

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

function ~OnionSkinViewState

~OnionSkinViewState() override =default

function getTypeName

inline virtual QString getTypeName() const override

Get unique type name for this editor state.

Return: Type name, e.g., “MediaWidget”, “DataViewerWidget”

Reimplements: EditorState::getTypeName

This is used for:

  • Factory registration
  • Serialization type field
  • Properties panel routing

function getDisplayName

virtual QString getDisplayName() const override

Get display name for UI.

Return: Display name, e.g., “Media Viewer 1”

Reimplements: EditorState::getDisplayName

This is the user-visible name shown in tabs, window titles, etc. It may be customized by the user.

function setDisplayName

virtual void setDisplayName(
    QString const & name
) override

Set display name.

Parameters:

  • name New display name

Reimplements: EditorState::setDisplayName

function horizontalAxisState

inline HorizontalAxisState * horizontalAxisState()

function verticalAxisState

inline VerticalAxisState * verticalAxisState()

function viewState

inline CorePlotting::ViewStateData const & viewState() const

Get the current view state (bounds + zoom + pan).

function setXZoom

void setXZoom(
    double zoom
)

function setYZoom

void setYZoom(
    double zoom
)

function setPan

void setPan(
    double x_pan,
    double y_pan
)

function setXBounds

void setXBounds(
    double x_min,
    double x_max
)

Set X data bounds and keep horizontal axis in sync.

Parameters:

  • x_min Minimum X value
  • x_max Maximum X value

function setYBounds

void setYBounds(
    double y_min,
    double y_max
)

Set Y data bounds and keep vertical axis in sync.

Parameters:

  • y_min Minimum Y value
  • y_max Maximum Y value

function getPointDataKeys

std::vector< QString > getPointDataKeys() const

Get all point data keys.

function addPointDataKey

void addPointDataKey(
    QString const & key
)

function removePointDataKey

void removePointDataKey(
    QString const & key
)

function clearPointDataKeys

void clearPointDataKeys()

function getLineDataKeys

std::vector< QString > getLineDataKeys() const

Get all line data keys.

function addLineDataKey

void addLineDataKey(
    QString const & key
)

function removeLineDataKey

void removeLineDataKey(
    QString const & key
)

function clearLineDataKeys

void clearLineDataKeys()

function getMaskDataKeys

std::vector< QString > getMaskDataKeys() const

Get all mask data keys.

function addMaskDataKey

void addMaskDataKey(
    QString const & key
)

function removeMaskDataKey

void removeMaskDataKey(
    QString const & key
)

function clearMaskDataKeys

void clearMaskDataKeys()

function getWindowBehind

inline int getWindowBehind() const

function setWindowBehind

void setWindowBehind(
    int behind
)

function getWindowAhead

inline int getWindowAhead() const

function setWindowAhead

void setWindowAhead(
    int ahead
)

function getAlphaCurve

inline QString getAlphaCurve() const

function setAlphaCurve

void setAlphaCurve(
    QString const & curve
)

function getMinAlpha

inline float getMinAlpha() const

function setMinAlpha

void setMinAlpha(
    float alpha
)

function getMaxAlpha

inline float getMaxAlpha() const

function setMaxAlpha

void setMaxAlpha(
    float alpha
)

function glyphStyleStateForKey

GlyphStyleState * glyphStyleStateForKey(
    QString const & key
)

Get the GlyphStyleState for a specific point data key.

Parameters:

  • key The point data key

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 getPointKeyGlyphStyle

CorePlotting::GlyphStyleData getPointKeyGlyphStyle(
    QString const & key
) const

Get the serializable glyph style data for a key (read-only).

Returns a default style if the key has not been added.

function lineStyleStateForKey

LineStyleState * lineStyleStateForKey(
    QString const & key
)

Get the LineStyleState for a specific line data key.

Parameters:

  • key The line data key

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 getLineKeyLineStyle

CorePlotting::LineStyleData getLineKeyLineStyle(
    QString const & key
) const

Get the serializable line style data for a key (read-only).

Returns a default style if the key has not been added.

function maskStyleStateForKey

LineStyleState * maskStyleStateForKey(
    QString const & key
)

Get the LineStyleState for a specific mask data key.

Parameters:

  • key The mask data key

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 getMaskKeyLineStyle

CorePlotting::LineStyleData getMaskKeyLineStyle(
    QString const & key
) const

Get the serializable mask contour style data for a key (read-only).

Returns a default style if the key has not been added.

function getHighlightCurrent

inline bool getHighlightCurrent() const

function setHighlightCurrent

void setHighlightCurrent(
    bool highlight
)

function toJson

virtual std::string toJson() const override

Serialize state to JSON string.

Return: JSON string representation of state

Reimplements: EditorState::toJson

Subclasses should use reflect-cpp for serialization: ```cpp

std::string toJson() const override { return rfl::json::write(_data); }



### function fromJson

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

Restore state from JSON string.

Parameters:

  • json JSON string to parse

Return: true if parsing succeeded, false on error

Reimplements: EditorState::fromJson

Subclasses should use reflect-cpp for deserialization: ```cpp

bool fromJson(std::string const& json) override { auto result = rfl::json::read(json); if (result) { _data = *result; emit stateChanged(); return true; } return false; } ```


Updated on 2026-11-13 at 20:25:40 +0000