9 const QList<int> &oldValues, std::function<
void()> onApplied,
11 : QUndoCommand(parent)
14 , m_oldValues(oldValues)
15 , m_onApplied(std::move(onApplied))
17 setText(QObject::tr(
"Edit waveform"));
21 m_newValues.reserve(m_cells.size());
22 for (
const auto &cell : m_cells) {
23 m_newValues.append(m_model->value(cell.first, cell.second));
29 applyValues(m_newValues);
34 applyValues(m_oldValues);
37void SetCellsCommand::applyValues(
const QList<int> &values)
39 for (
int i = 0; i < m_cells.size(); ++i) {
40 m_model->
setValue(m_cells.at(i).first, m_cells.at(i).second, values.at(i));
DolphinCommands: undo/redo commands for the beWavedDolphin waveform editor.
SignalModel for the beWavedDolphin waveform table.
SetCellsCommand(SignalModel *model, const QList< QPair< int, int > > &cells, const QList< int > &oldValues, std::function< void()> onApplied, QUndoCommand *parent=nullptr)
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).