31 lines
761 B
C++
31 lines
761 B
C++
#ifndef EDITITEMCOMMAND_H
|
|
#define EDITITEMCOMMAND_H
|
|
|
|
#include <QMap>
|
|
#include <QUndoCommand>
|
|
|
|
class TableModel;
|
|
|
|
class EditItemCommand : public QUndoCommand {
|
|
public:
|
|
EditItemCommand(TableModel* model,
|
|
const QModelIndex& index,
|
|
QMap<int, QVariant>& changedValues,
|
|
QUndoCommand* parent = nullptr);
|
|
/// QUndoCommand interface
|
|
void undo();
|
|
void redo();
|
|
|
|
private:
|
|
TableModel* m_model = nullptr;
|
|
const int m_row;
|
|
QMap<int, QVariant> m_oldValues;
|
|
QMap<int, QVariant> m_newValues;
|
|
|
|
/// private functions
|
|
const QMap<int, QVariant> getOldValues(const QModelIndex& index,
|
|
const QMap<int, QVariant>& changedValues) const;
|
|
};
|
|
|
|
#endif // EDITITEMCOMMAND_H
|