Skip to main content

DataManagerWidgetState

DataManagerWidgetState

State class for DataManager_Widget. More…

#include <DataManagerWidgetState.hpp>

Inherits from EditorState, QObject

Public Signals

Name
void selectedDataKeyChanged(QString const & key)
Emitted when the selected data key changes.

Public Functions

Name
DataManagerWidgetState(QObject * parent =[nullptr])
Construct a new DataManagerWidgetState.
~DataManagerWidgetState() 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 setSelectedDataKey(QString const & key)
Set the selected data key.
QString selectedDataKey() const
Get the selected data key.

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

State class for DataManager_Widget.

DataManagerWidgetState is a minimal EditorState subclass that tracks the selected data key in the DataManager_Widget’s feature table.

Usage


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

// Connect to selection changes
connect(state.get(), &DataManagerWidgetState::selectedDataKeyChanged,
        this, &MyWidget::onDataKeyChanged);

// Update selection
state->setSelectedDataKey("my_data_key");

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

Integration with SelectionContext

The widget should forward state changes to SelectionContext:


connect(_state.get(), &DataManagerWidgetState::selectedDataKeyChanged,
        this, [this](QString const& key) {
    SelectionSource source{_state->getInstanceId(), "feature_table"};
    _selection_context->setSelectedData(key, source);
});

Public Signals Documentation

signal selectedDataKeyChanged

void selectedDataKeyChanged(
    QString const & key
)

Emitted when the selected data key changes.

Parameters:

  • key The new selected data key

Public Functions Documentation

function DataManagerWidgetState

explicit DataManagerWidgetState(
    QObject * parent =nullptr
)

Construct a new DataManagerWidgetState.

Parameters:

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

function ~DataManagerWidgetState

~DataManagerWidgetState() override =default

function getTypeName

inline virtual QString getTypeName() const override

Get the type name for this state.

Return: “DataManagerWidget”

Reimplements: EditorState::getTypeName

function getDisplayName

virtual QString getDisplayName() const override

Get the display name for UI.

Return: User-visible name (default: “Data 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 setSelectedDataKey

void setSelectedDataKey(
    QString const & key
)

Set the selected data key.

Parameters:

  • key Data key to select (empty string to clear selection)

This represents the currently highlighted/selected data in the DataManager_Widget’s feature table.

function selectedDataKey

QString selectedDataKey() const

Get the selected data key.

Return: Currently selected data key, or empty string if none


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