Skip to main content

TableDesignerState

TableDesignerState

State class for TableDesignerWidget. More…

#include <TableDesignerState.hpp>

Inherits from EditorState, QObject

Public Signals

Name
void currentTableIdChanged(QString const & table_id)
Emitted when the current table ID changes.
void rowSettingsChanged()
Emitted when any row setting changes.
void groupSettingsChanged()
Emitted when group mode settings change.
void computerStateChanged(QString const & key)
Emitted when a computer state changes.
void computerStatesCleared()
Emitted when all computer states are cleared.
void columnOrderChanged(QString const & table_id)
Emitted when column order changes for a table.

Public Functions

Name
TableDesignerState(QObject * parent =[nullptr])
Construct a new TableDesignerState.
~TableDesignerState() 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.
TableDesignerStateData const & data() const
Get const reference to underlying data for efficiency.
void setCurrentTableId(QString const & table_id)
Set the currently selected table ID.
QString currentTableId() const
Get the currently selected table ID.
void setRowSourceName(QString const & source_name)
Set the row source name.
QString rowSourceName() const
Get the row source name.
void setCaptureRange(int range)
Set the capture range for interval mode.
int captureRange() const
Get the capture range.
void setIntervalMode(IntervalRowMode mode)
Set the interval row mode.
IntervalRowMode intervalMode() const
Get the interval row mode.
void setRowSettings(RowSourceSettings const & settings)
Set the complete row settings.
RowSourceSettings const & rowSettings() const
Get the complete row settings.
void setGroupModeEnabled(bool enabled)
Enable or disable group mode.
bool groupModeEnabled() const
Check if group mode is enabled.
void setGroupingPattern(QString const & pattern)
Set the grouping regex pattern.
QString groupingPattern() const
Get the grouping regex pattern.
void setGroupSettings(GroupModeSettings const & settings)
Set the complete group mode settings.
GroupModeSettings const & groupSettings() const
Get the complete group mode settings.
void setComputerEnabled(QString const & key, bool enabled)
Set whether a computer is enabled.
bool isComputerEnabled(QString const & key) const
Check if a computer is enabled.
void setComputerColumnName(QString const & key, QString const & column_name)
Set the custom column name for a computer.
QString computerColumnName(QString const & key) const
Get the custom column name for a computer.
ComputerStateEntry const * getComputerState(QString const & key) const
Get the complete state for a computer.
void setComputerState(QString const & key, ComputerStateEntry const & state)
Set the complete state for a computer.
bool removeComputerState(QString const & key)
Remove a computer state entry.
void clearComputerStates()
Clear all computer states.
QStringList enabledComputerKeys() const
Get all computer keys that are enabled.
std::map< std::string, ComputerStateEntry > const & computerStates() const
Get all computer states as a map.
void setColumnOrder(QString const & table_id, QStringList const & column_names)
Set the column order for a table’s preview.
QStringList columnOrder(QString const & table_id) const
Get the column order for a table’s preview.
bool removeColumnOrder(QString const & table_id)
Remove the column order for a table.
void clearColumnOrders()
Clear all column orders.

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

State class for TableDesignerWidget.

TableDesignerState is the Qt wrapper around TableDesignerStateData that provides typed accessors and Qt signals for all state properties.

Signal Categories

  • Table Selection: currentTableIdChanged
  • Row Settings: rowSettingsChanged
  • Group Mode: groupSettingsChanged
  • Computer States: computerStateChanged
  • Column Order: columnOrderChanged

Thread Safety

This class is NOT thread-safe. All access should be from the main/GUI thread.

Public Signals Documentation

signal currentTableIdChanged

void currentTableIdChanged(
    QString const & table_id
)

Emitted when the current table ID changes.

Parameters:

  • table_id New table ID

signal rowSettingsChanged

void rowSettingsChanged()

Emitted when any row setting changes.

signal groupSettingsChanged

void groupSettingsChanged()

Emitted when group mode settings change.

signal computerStateChanged

void computerStateChanged(
    QString const & key
)

Emitted when a computer state changes.

Parameters:

  • key The computer key that changed

signal computerStatesCleared

void computerStatesCleared()

Emitted when all computer states are cleared.

signal columnOrderChanged

void columnOrderChanged(
    QString const & table_id
)

Emitted when column order changes for a table.

Parameters:

  • table_id The table ID whose order changed

Public Functions Documentation

function TableDesignerState

explicit TableDesignerState(
    QObject * parent =nullptr
)

Construct a new TableDesignerState.

Parameters:

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

function ~TableDesignerState

~TableDesignerState() override =default

function getTypeName

inline virtual QString getTypeName() const override

Get the type name for this state.

Return: “TableDesigner”

Reimplements: EditorState::getTypeName

function getDisplayName

virtual QString getDisplayName() const override

Get the display name for UI.

Return: User-visible name (default: “Table Designer”)

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 data

inline TableDesignerStateData const & data() const

Get const reference to underlying data for efficiency.

Return: Const reference to TableDesignerStateData

Use this for reading multiple values without individual accessor overhead. For modification, use the typed setters to ensure signals are emitted.

function setCurrentTableId

void setCurrentTableId(
    QString const & table_id
)

Set the currently selected table ID.

Parameters:

  • table_id Table ID (empty string to clear selection)

function currentTableId

inline QString currentTableId() const

Get the currently selected table ID.

Return: Current table ID, or empty string if none selected

function setRowSourceName

void setRowSourceName(
    QString const & source_name
)

Set the row source name.

Parameters:

  • source_name Row source (e.g., “Intervals: trials”, “Events: licks”)

function rowSourceName

inline QString rowSourceName() const

Get the row source name.

Return: Current row source name

function setCaptureRange

void setCaptureRange(
    int range
)

Set the capture range for interval mode.

Parameters:

  • range Capture range in samples

function captureRange

inline int captureRange() const

Get the capture range.

Return: Current capture range in samples

function setIntervalMode

void setIntervalMode(
    IntervalRowMode mode
)

Set the interval row mode.

Parameters:

  • mode How intervals are used (Beginning, End, or Itself)

function intervalMode

inline IntervalRowMode intervalMode() const

Get the interval row mode.

Return: Current interval mode

function setRowSettings

void setRowSettings(
    RowSourceSettings const & settings
)

Set the complete row settings.

Parameters:

  • settings New row settings

function rowSettings

inline RowSourceSettings const & rowSettings() const

Get the complete row settings.

Return: Const reference to RowSourceSettings

function setGroupModeEnabled

void setGroupModeEnabled(
    bool enabled
)

Enable or disable group mode.

Parameters:

  • enabled Whether group mode should be active

function groupModeEnabled

inline bool groupModeEnabled() const

Check if group mode is enabled.

Return: true if group mode is active

function setGroupingPattern

void setGroupingPattern(
    QString const & pattern
)

Set the grouping regex pattern.

Parameters:

  • pattern Regex pattern for grouping data sources

function groupingPattern

inline QString groupingPattern() const

Get the grouping regex pattern.

Return: Current grouping pattern

function setGroupSettings

void setGroupSettings(
    GroupModeSettings const & settings
)

Set the complete group mode settings.

Parameters:

  • settings New group settings

function groupSettings

inline GroupModeSettings const & groupSettings() const

Get the complete group mode settings.

Return: Const reference to GroupModeSettings

function setComputerEnabled

void setComputerEnabled(
    QString const & key,
    bool enabled
)

Set whether a computer is enabled.

Parameters:

  • key Computer key (format: “dataSource||computerName”)
  • enabled Whether the computer is enabled

function isComputerEnabled

bool isComputerEnabled(
    QString const & key
) const

Check if a computer is enabled.

Parameters:

  • key Computer key

Return: true if enabled, false if disabled or not found

function setComputerColumnName

void setComputerColumnName(
    QString const & key,
    QString const & column_name
)

Set the custom column name for a computer.

Parameters:

  • key Computer key (format: “dataSource||computerName”)
  • column_name Custom column name (empty = use default)

function computerColumnName

QString computerColumnName(
    QString const & key
) const

Get the custom column name for a computer.

Parameters:

  • key Computer key

Return: Custom column name, or empty string if using default

function getComputerState

ComputerStateEntry const * getComputerState(
    QString const & key
) const

Get the complete state for a computer.

Parameters:

  • key Computer key

Return: Pointer to ComputerStateEntry, or nullptr if not found

function setComputerState

void setComputerState(
    QString const & key,
    ComputerStateEntry const & state
)

Set the complete state for a computer.

Parameters:

  • key Computer key
  • state The computer state

function removeComputerState

bool removeComputerState(
    QString const & key
)

Remove a computer state entry.

Parameters:

  • key Computer key

Return: true if removed, false if not found

function clearComputerStates

void clearComputerStates()

Clear all computer states.

function enabledComputerKeys

QStringList enabledComputerKeys() const

Get all computer keys that are enabled.

Return: List of enabled computer keys

function computerStates

inline std::map< std::string, ComputerStateEntry > const & computerStates() const

Get all computer states as a map.

Return: Const reference to the computer states map

function setColumnOrder

void setColumnOrder(
    QString const & table_id,
    QStringList const & column_names
)

Set the column order for a table’s preview.

Parameters:

  • table_id Table ID
  • column_names Ordered list of column names

function columnOrder

QStringList columnOrder(
    QString const & table_id
) const

Get the column order for a table’s preview.

Parameters:

  • table_id Table ID

Return: Ordered list of column names, or empty list if not set

function removeColumnOrder

bool removeColumnOrder(
    QString const & table_id
)

Remove the column order for a table.

Parameters:

  • table_id Table ID

Return: true if removed, false if not found

function clearColumnOrders

void clearColumnOrders()

Clear all column orders.


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