31 lines
773 B
C++
31 lines
773 B
C++
#ifndef INSERTROWSCOMMAND_H
|
|
#define INSERTROWSCOMMAND_H
|
|
|
|
#include <QUndoCommand>
|
|
|
|
typedef QHash<int, QVariant> ModelItemValues;
|
|
|
|
class TableModel;
|
|
|
|
class InsertRowsCommand : public QUndoCommand {
|
|
public:
|
|
// TODO don't use simple pointer to model
|
|
/// Using simple pointer to model because there was a crash when closing the application with an
|
|
/// unclean undo stack
|
|
InsertRowsCommand(TableModel* model,
|
|
int startRow,
|
|
QList<ModelItemValues> valueList,
|
|
QUndoCommand* parent = nullptr);
|
|
|
|
/// QUndoCommand interface
|
|
void undo() override;
|
|
void redo() override;
|
|
|
|
private:
|
|
TableModel* m_tableModel;
|
|
const int m_startRow;
|
|
const QList<ModelItemValues> m_valueList;
|
|
};
|
|
|
|
#endif // INSERTROWSCOMMAND_H
|