-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathundocommands.h
65 lines (50 loc) · 1.61 KB
/
undocommands.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef UNDOCOMMANDS
#define UNDOCOMMANDS
#include <QUndoCommand>
#include "datapoint.h"
namespace weighttracker {
class WeightTableModel;
/******************************************************************************
RemoveRowCommand
******************************************************************************/
class RemoveRowCommand : public QUndoCommand
{
public:
RemoveRowCommand(WeightTableModel *model, int row, QUndoCommand *parent = 0);
void undo() override;
void redo() override;
private:
WeightTableModel* model_;
int row_;
DataPoint dp_;
};
/******************************************************************************
AddRowCommand
******************************************************************************/
class AddRowCommand : public QUndoCommand
{
public:
AddRowCommand(WeightTableModel *model, int row, QDate date, double weight, QUndoCommand *parent = 0);
void undo() override;
void redo() override;
private:
WeightTableModel* model_;
int row_;
DataPoint dp_;
};
/******************************************************************************
ModifyRowCommand
******************************************************************************/
class ModifyRowCommand : public QUndoCommand
{
public:
ModifyRowCommand(WeightTableModel *model, int row, double weight, QUndoCommand *parent = 0);
void undo() override;
void redo() override;
private:
WeightTableModel* model_;
int row_;
double oldWeight_, newWeight_;
};
}
#endif // UNDOCOMMANDS