Engauge Digitizer  2
 All Classes Files Functions Variables Enumerations Enumerator Friends Pages
CmdAbstract.h
1 #ifndef CMD_ABSTRACT_H
2 #define CMD_ABSTRACT_H
3 
4 #include <QUndoCommand>
5 
6 class Document;
7 class MainWindow;
8 class QXmlStreamWriter;
9 
11 class CmdAbstract : public QUndoCommand
12 {
13 public:
17  const QString &cmdDescription);
18 
19  virtual ~CmdAbstract();
20 
22  virtual void cmdRedo () = 0;
23 
25  virtual void cmdUndo () = 0;
26 
28  virtual void saveXml (QXmlStreamWriter &writer) const = 0;
29 
30 protected:
32  Document &document();
33 
35  const Document &document() const;
36 
39 
40 private:
41  CmdAbstract();
42 
43  virtual void redo (); // Calls cmdRedo
44  virtual void undo (); // Calls cmdUndo
45 
46  MainWindow &m_mainWindow;
47  Document &m_document;
48 
49  // Snapshots of GraphicsPointAbstractBase::identifierIndex before and after redo
50  bool m_isFirstRedo;
51  unsigned int m_identifierIndexBeforeRedo;
52  unsigned int m_identifierIndexAfterRedo;
53 };
54 
55 #endif // CMD_ABSTRACT_H
Wrapper around QUndoCommand. This simplifies the more complicated feature set of QUndoCommand.
Definition: CmdAbstract.h:11
virtual void cmdRedo()=0
Redo method that is called when QUndoStack is moved one command forward.
MainWindow & mainWindow()
Return the MainWindow so it can be updated by this command as a last step.
Definition: CmdAbstract.cpp:32
Storage of one imported image and the data attached to that image.
Definition: Document.h:29
virtual void cmdUndo()=0
Undo method that is called when QUndoStack is moved one command backward.
virtual void saveXml(QXmlStreamWriter &writer) const =0
Save commands as xml for later uploading.
Document & document()
Return the Document that this command will modify during redo and undo.
Definition: CmdAbstract.cpp:22
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition: MainWindow.h:60