wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
SignalModel Class Reference

QStandardItemModel subclass that makes all cells non-editable. More...

#include <SignalModel.h>

Inheritance diagram for SignalModel:
[legend]

Classes

class  BulkEditGuard

Public Member Functions

Qt::ItemFlags flags (const QModelIndex &index) const override
int inputRows () const
 Returns the number of input rows (the output rows follow them).
bool isInputRow (int row) const
 Returns true if row is an input row (row < inputRows()).
void setInputRows (int inputRows)
 Records how many leading rows are inputs (the rest are outputs).
void setValue (int row, int col, int value)
 Sets the logic value (0/1) of the cell at (row, col).
 SignalModel (int rows, int columns, QObject *parent=nullptr)
 Constructs the model.
int value (int row, int col) const
 Returns the logic value (0/1) of the cell at (row, col).

Static Public Attributes

static constexpr int kMaxColumns = 2048

Detailed Description

QStandardItemModel subclass that makes all cells non-editable.

All editing is done programmatically via BewavedDolphin::setCellValue(). The model enforces read-only at the Qt item level so the table view never opens an inline editor.

Definition at line 20 of file SignalModel.h.

Constructor & Destructor Documentation

◆ SignalModel()

SignalModel::SignalModel ( int rows,
int columns,
QObject * parent = nullptr )

Constructs the model.

Parameters
inputsNumber of input signal rows (stored for reference).
rowsTotal number of signal rows.
columnsNumber of time-step columns.
parentOptional parent object.

Definition at line 6 of file SignalModel.cpp.

Referenced by SignalModel::BulkEditGuard::BulkEditGuard().

Member Function Documentation

◆ flags()

Qt::ItemFlags SignalModel::flags ( const QModelIndex & index) const
override
Reimplemented from base class. Returns Qt::ItemIsEnabled only (no editing).

Definition at line 11 of file SignalModel.cpp.

◆ inputRows()

int SignalModel::inputRows ( ) const
inline

Returns the number of input rows (the output rows follow them).

Definition at line 55 of file SignalModel.h.

Referenced by DolphinClipboard::paste(), and setInputRows().

◆ isInputRow()

bool SignalModel::isInputRow ( int row) const
inline

Returns true if row is an input row (row < inputRows()).

Definition at line 58 of file SignalModel.h.

◆ setInputRows()

void SignalModel::setInputRows ( int inputRows)

Records how many leading rows are inputs (the rest are outputs).

Definition at line 28 of file SignalModel.cpp.

References inputRows().

◆ setValue()

void SignalModel::setValue ( int row,
int col,
int value )

◆ value()

int SignalModel::value ( int row,
int col ) const

Member Data Documentation

◆ kMaxColumns

int SignalModel::kMaxColumns = 2048
staticconstexpr

Maximum number of time-step columns a waveform may have. Single source of truth for the upper bound, shared by the file loaders, the runtime length, and the MCP cap. The minimum is intentionally context-specific (a saved file needs >= 2 columns; a runtime length allows >= 1) and is not centralized here.

Definition at line 38 of file SignalModel.h.

Referenced by DolphinSerializer::loadBinary(), DolphinSerializer::loadCSV(), DolphinFile::parseTerminal(), and BewavedDolphin::saveToTxt().


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