MockState
MockState
Inherits from EditorState, QObject
Public Functions
| Name | |
|---|---|
| MockState(QString type_name =“MockState”, QObject * parent =[nullptr]) | |
| virtual QString | getTypeName() const override Get unique type name for this editor state. |
| virtual std::string | toJson() const override Serialize state to JSON string. |
| virtual bool | fromJson(std::string const & json) override Restore state from JSON string. |
| void | setName(std::string const & name) |
| std::string | getName() const |
| void | setValue(int value) |
| int | getValue() const |
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. |
|
| virtual QString | getDisplayName() const Get display name for UI. |
| virtual void | setDisplayName(QString const & name) Set display name. |
| 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. |
Public Functions Documentation
function MockState
inline explicit MockState(
QString type_name ="MockState",
QObject * parent =nullptr
)function getTypeName
inline virtual QString getTypeName() const overrideGet 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 toJson
inline virtual std::string toJson() const overrideSerialize 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
inline 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
### function setName
```cpp
inline void setName(
std::string const & name
)
function getName
inline std::string getName() constfunction setValue
inline void setValue(
int value
)function getValue
inline int getValue() constUpdated on 2026-11-13 at 20:25:40 +0000