SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
SWMMAttributeTableModel Class Reference

#include <swmmattributetablemodel.h>

Inheritance diagram for SWMMAttributeTableModel:
Collaboration diagram for SWMMAttributeTableModel:

Public Slots

void reload ()
 
void refreshObject (const QString &name)
 

Signals

void objectEdited (const QString &name)
 

Public Member Functions

 SWMMAttributeTableModel (QObject *parent=nullptr)
 
void setSource (SWMMModelLayer *layer, SWMMModelLayer::Category category)
 
void setResultsSource (SWMMResultsLayer *layer)
 
SWMMResultsLayerresultsSource () const
 
SWMMModelLayerlayer () const noexcept
 
SWMMModelLayer::Category category () const noexcept
 
QString objectNameAt (int row) const
 
int rowForName (const QString &name) const
 
QStringList columnKeys () const
 
QList< openswmmvis::ColumnSpeccolumnSpecs () const
 
void refreshHeaders ()
 
void setUndoStack (QUndoStack *stack)
 
QUndoStack * undoStack () const
 
bool commitValueDirect (const QModelIndex &index, const QVariant &value)
 
int rowCount (const QModelIndex &parent={}) const override
 
int columnCount (const QModelIndex &parent={}) const override
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 

Constructor & Destructor Documentation

◆ SWMMAttributeTableModel()

SWMMAttributeTableModel::SWMMAttributeTableModel ( QObject *  parent = nullptr)
explicit
Here is the call graph for this function:

Member Function Documentation

◆ category()

SWMMModelLayer::Category SWMMAttributeTableModel::category ( ) const
inlinenoexcept
Here is the caller graph for this function:

◆ columnCount()

int SWMMAttributeTableModel::columnCount ( const QModelIndex &  parent = {}) const
override
Here is the caller graph for this function:

◆ columnKeys()

QStringList SWMMAttributeTableModel::columnKeys ( ) const
inline

Column-zero header is always "Name"; column 0 returns the object's name unmodified. The remaining columns map to keys from the layer's identify map; column count is fixed per category.

◆ columnSpecs()

QList< openswmmvis::ColumnSpec > SWMMAttributeTableModel::columnSpecs ( ) const
inline

Slice Z.5.2 — column metadata (delegate kind, setter, range). Returns the full spec list for the bound category so callers (e.g. AttributeTablePanel) can install delegates.

◆ commitValueDirect()

bool SWMMAttributeTableModel::commitValueDirect ( const QModelIndex &  index,
const QVariant &  value 
)

Direct-commit setter — bypasses the undo stack. Used by EditCommand::redo / undo so re-applying a command doesn't push another command.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ data()

QVariant SWMMAttributeTableModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
override
Here is the call graph for this function:
Here is the caller graph for this function:

◆ flags()

Qt::ItemFlags SWMMAttributeTableModel::flags ( const QModelIndex &  index) const
override
Here is the call graph for this function:

◆ headerData()

QVariant SWMMAttributeTableModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
override

◆ layer()

SWMMModelLayer * SWMMAttributeTableModel::layer ( ) const
inlinenoexcept
Here is the caller graph for this function:

◆ objectEdited

void SWMMAttributeTableModel::objectEdited ( const QString &  name)
signal

Emitted after a successful direct-edit commit (Attribute Table cell editor → engine setter). Listeners (e.g. the Property Browser dock) use this to refresh their view of the same object. Distinct from QAbstractItemModel:: dataChanged because it fires only on user-initiated edits, not on synthetic refreshes — preventing feedback loops.

Here is the caller graph for this function:

◆ objectNameAt()

QString SWMMAttributeTableModel::objectNameAt ( int  row) const

Object name for a row, or empty string if out of range.

Here is the caller graph for this function:

◆ refreshHeaders()

void SWMMAttributeTableModel::refreshHeaders ( )

Re-query every horizontal header. Call after a change that alters a render-time label without touching the schema (LINK_OFFSETS mode → offset columns read "… Elevation").

Here is the call graph for this function:
Here is the caller graph for this function:

◆ refreshObject

void SWMMAttributeTableModel::refreshObject ( const QString &  name)
slot

Round-4 follow-up 2026-05-12 — refresh a single row by object name. Invalidates the row cache so the next data() read re-queries the engine, and emits dataChanged across the row so the view repaints. Used by the panel to mirror property- browser edits without doing a full reset.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reload

void SWMMAttributeTableModel::reload ( )
slot

Force a full reload (e.g. after the underlying SoA changed).

◆ resultsSource()

SWMMResultsLayer * SWMMAttributeTableModel::resultsSource ( ) const
inline

◆ rowCount()

int SWMMAttributeTableModel::rowCount ( const QModelIndex &  parent = {}) const
override
Here is the caller graph for this function:

◆ rowForName()

int SWMMAttributeTableModel::rowForName ( const QString &  name) const

Inverse — find the model row for a given object name in the current category. Returns -1 if not found.

Here is the caller graph for this function:

◆ setData()

bool SWMMAttributeTableModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::EditRole 
)
override
Here is the call graph for this function:

◆ setResultsSource()

void SWMMAttributeTableModel::setResultsSource ( SWMMResultsLayer layer)

Bind the post-run "dynamics" columns to a loaded output.

Those columns used to read the EDITING engine's ambient statistics (swmm_node_get_stat_* and friends). Nothing ever populates them: SimulationRunner runs on its own throw-away SWMM_Engine (or an out-of-process worker), so the editing engine never reaches the ENDED state the stat getters need and every dynamics cell read back zero. Pointing the model at the active results layer instead makes the columns show the run the user actually selected, and re-pointing it swaps every dynamics value to the new run.

Pass nullptr to fall back to the editing engine.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSource()

void SWMMAttributeTableModel::setSource ( SWMMModelLayer layer,
SWMMModelLayer::Category  category 
)

Bind the model to a (layer, category) pair. Rebuilds the column schema, then beginResetModel / endResetModel. Pass a null layer to clear.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setUndoStack()

void SWMMAttributeTableModel::setUndoStack ( QUndoStack *  stack)
inline

Slice Z.5.5 — optional QUndoStack for cell-edit commands. When set, setData() wraps each commit in an EditCommand pushed onto this stack so Ctrl+Z / Ctrl+Y round-trip. Pass nullptr to disable undo (edits commit immediately).

Here is the caller graph for this function:

◆ undoStack()

QUndoStack * SWMMAttributeTableModel::undoStack ( ) const
inline

The documentation for this class was generated from the following files: