wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
SignalModel.h
Go to the documentation of this file.
1// Copyright 2015 - 2026, GIBIS-UNIFESP and the wiRedPanda contributors
2// SPDX-License-Identifier: GPL-3.0-or-later
3
7
8#pragma once
9
10#include <QStandardItemModel>
11
20class SignalModel : public QStandardItemModel
21{
22 Q_OBJECT
23
24public:
32 SignalModel(int rows, int columns, QObject *parent = nullptr);
33
38 static constexpr int kMaxColumns = 2048;
39
41 Qt::ItemFlags flags(const QModelIndex &index) const override;
42
43 // --- Waveform data access ---
44
46 void setValue(int row, int col, int value);
47
49 int value(int row, int col) const;
50
52 void setInputRows(int inputRows);
53
55 int inputRows() const { return m_inputRows; }
56
58 bool isInputRow(int row) const { return row < m_inputRows; }
59
65 public:
66 explicit BulkEditGuard(SignalModel &model);
68
69 private:
70 SignalModel &m_model;
71 };
72
73private:
74 void notifyBulkChanged();
75
76 int m_inputRows = 0;
77};
BulkEditGuard(SignalModel &model)
void setValue(int row, int col, int value)
Sets the logic value (0/1) of the cell at (row, col).
int value(int row, int col) const
Returns the logic value (0/1) of the cell at (row, col).
void setInputRows(int inputRows)
Records how many leading rows are inputs (the rest are outputs).
int inputRows() const
Returns the number of input rows (the output rows follow them).
Definition SignalModel.h:55
SignalModel(int rows, int columns, QObject *parent=nullptr)
Constructs the model.
bool isInputRow(int row) const
Returns true if row is an input row (row < inputRows()).
Definition SignalModel.h:58
Qt::ItemFlags flags(const QModelIndex &index) const override
static constexpr int kMaxColumns
Definition SignalModel.h:38