Skip to main content

GroupManagementWidgetState

GroupManagementWidgetState

State class for GroupManagementWidget. More…

#include <GroupManagementWidgetState.hpp>

Inherits from EditorState, QObject

Public Signals

Name
void selectedGroupChanged(int group_id)
Emitted when the selected group changes.

Public Functions

Name
GroupManagementWidgetState(QObject * parent =[nullptr])
Construct a new GroupManagementWidgetState.
~GroupManagementWidgetState() 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.
virtual std::string toJson() const override
Serialize state to JSON.
virtual bool fromJson(std::string const & json) override
Restore state from JSON.
void setSelectedGroupId(int group_id)
Set the selected group ID.
int selectedGroupId() const
Get the selected group ID.

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

State class for GroupManagementWidget.

GroupManagementWidgetState is a minimal EditorState subclass that tracks the selected group in the GroupManagementWidget’s table.

Usage


// Create state (typically done by EditorRegistry)
auto state = std::make_shared<GroupManagementWidgetState>();

// Connect to selection changes
connect(state.get(), &GroupManagementWidgetState::selectedGroupChanged,
        this, &MyWidget::onGroupChanged);

// Update selection
state->setSelectedGroupId(5);

// Serialize for workspace save
std::string json = state->toJson();

Public Signals Documentation

signal selectedGroupChanged

void selectedGroupChanged(
    int group_id
)

Emitted when the selected group changes.

Parameters:

  • group_id The new selected group ID (-1 if none)

Public Functions Documentation

function GroupManagementWidgetState

explicit GroupManagementWidgetState(
    QObject * parent =nullptr
)

Construct a new GroupManagementWidgetState.

Parameters:

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

function ~GroupManagementWidgetState

~GroupManagementWidgetState() override =default

function getTypeName

inline virtual QString getTypeName() const override

Get the type name for this state.

Return: “GroupManagementWidget”

Reimplements: EditorState::getTypeName

function getDisplayName

virtual QString getDisplayName() const override

Get the display name for UI.

Return: User-visible name (default: “Group Manager”)

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

function setSelectedGroupId

void setSelectedGroupId(
    int group_id
)

Set the selected group ID.

Parameters:

  • group_id Group ID to select (-1 to clear selection)

This represents the currently highlighted/selected group in the GroupManagementWidget’s table.

function selectedGroupId

int selectedGroupId() const

Get the selected group ID.

Return: Currently selected group ID, or -1 if none


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