15 for (
const auto &cell : cells) {
16 model.
setValue(cell.row(), cell.column(), valueFn(model.
value(cell.row(), cell.column())));
24 const int halfPeriod = period / 2;
27 for (
const auto &cell : cells) {
28 const int value = ((cell.column() - firstCol) % period < halfPeriod ? 0 : 1);
29 model.
setValue(cell.row(), cell.column(), value);
37 int halfClockPeriod = 1;
41 for (
int row = 0; row < inputPorts; ++row) {
42 for (
int col = 0; col < columns; ++col) {
43 model.
setValue(row, col, (col % clockPeriod < halfClockPeriod ? 0 : 1));
47 halfClockPeriod = (std::min)(clockPeriod, 524288);
48 clockPeriod = (std::min)(2 * clockPeriod, 1048576);
55 for (
int row = 0; row < inputPorts; ++row) {
56 for (
int col = 0; col < model.columnCount(); ++col) {
64 for (
int col = model.columnCount() - 1; col >= 0; --col) {
65 for (
int row = 0; row < inputPorts; ++row) {
66 if (model.
value(row, col) != 0) {
80 for (
int row = 0; row < inputPorts; ++row) {
81 for (
int col = oldLength; col < newLength; ++col) {
DolphinEdits: pure value-grid mutations for the beWavedDolphin waveform table.
SignalModel for the beWavedDolphin waveform table.
QStandardItemModel subclass that makes all cells non-editable.
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).
Pure mutations of a SignalModel's value grid — the data side of the editor's commands (set/invert/cle...
void combinational(SignalModel &model, const int inputPorts, const int columns)
void clearInputs(SignalModel &model, const int inputPorts)
Sets every input cell (the first inputPorts rows, over the model's columns) to 0.
void applyToCells(SignalModel &model, const QModelIndexList &cells, const std::function< int(int)> &valueFn)
Sets each cell in cells to valueFn(currentValue).
void growInputColumns(SignalModel &model, const int inputPorts, const int oldLength, const int newLength)
int lastNonZeroColumn(const SignalModel &model, const int inputPorts)
Returns the index of the last column with any non-zero input value, or 0 if none.
void clockWave(SignalModel &model, const QModelIndexList &cells, const int firstCol, const int period)