Skip to main content

CommandLogState

CommandLogState

Minimal state class for the Command Log widget. More…

#include <CommandLogState.hpp>

Inherits from EditorState, QObject

Public Functions

Name
CommandLogState(QObject * parent =[nullptr])
~CommandLogState() 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.
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 CommandLogState;

Minimal state class for the Command Log widget.

The Command Log widget displays recorded commands from CommandRecorder. It has no meaningful persistent state beyond its instance identity.

Public Functions Documentation

function CommandLogState

explicit CommandLogState(
    QObject * parent =nullptr
)

function ~CommandLogState

~CommandLogState() 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 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:41 +0000