18#include <QGraphicsItem>
22 const QString &cmdDescription) :
23 QUndoCommand (cmdDescription),
24 m_mainWindow (mainWindow),
25 m_document (document),
50void CmdAbstract::redo ()
72 m_isFirstRedo =
false;
77 LOG4CPP_INFO_S ((*
mainCat)) <<
"CmdAbstract::redo identifierIndex=" << m_identifierIndexBeforeRedo <<
"->"
78 << m_identifierIndexAfterRedo;
86 QList<QGraphicsItem *>::iterator itrS;
87 for (itrS = items.begin (); itrS != items.end (); itrS++) {
89 QGraphicsItem *item = *itrS;
90 bool selected =
false;
95 selected = pointIdentifiersToSelect.
contains (pointIdentifier);
98 item->setSelected (selected);
109 if (m_documentHashPost.count() == 0) {
112 m_documentHashPost = documentHash;
121 LOG4CPP_INFO_S ((*
mainCat)) <<
"CmdAbstract::saveOrCheckPostCommandDocumentStateHash stateHash=" << m_documentHashPost.data ();
132 if (m_documentHashPre.count() == 0) {
135 m_documentHashPre = documentHash;
144 LOG4CPP_INFO_S ((*
mainCat)) <<
"CmdAbstract::saveOrCheckPreCommandDocumentStateHash stateHash=" << m_documentHashPre.data ();
148void CmdAbstract::undo ()
150 LOG4CPP_INFO_S ((*
mainCat)) <<
"CmdAbstract::undo identifierIndex=" << m_identifierIndexAfterRedo <<
"->"
151 << m_identifierIndexBeforeRedo;
@ DATA_KEY_GRAPHICS_ITEM_TYPE
Unique identifier for QGraphicsItem object
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...
@ GRAPHICS_ITEM_TYPE_POINT
log4cpp::Category * mainCat
Document & document()
Return the Document that this command will modify during redo and undo.
MainWindow & mainWindow()
Return the MainWindow so it can be updated by this command as a last step.
virtual void cmdUndo()=0
Undo method that is called when QUndoStack is moved one command backward.
void saveOrCheckPostCommandDocumentStateHash(const Document &document)
Save, when called the first time, a hash value representing the state of the Document.
void saveOrCheckPreCommandDocumentStateHash(const Document &document)
Save, when called the first time, a hash value representing the state of the Document.
void resetSelection(const PointIdentifiers &pointIdentifiersToSelect)
Since the set of selected points has probably changed, changed that set back to the specified set.
CmdAbstract(MainWindow &mainWindow, Document &document, const QString &cmdDescription)
Single constructor.
virtual void cmdRedo()=0
Redo method that is called when QUndoStack is moved one command forward.
Generates a DocumentHash value representing the state of the entire Document.
DocumentHash generate(const Document &document) const
Generate the hash for external storage.
Storage of one imported image and the data attached to that image.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
GraphicsView & view()
View for the QImage and QGraphicsItems, without const.
Hash table class that tracks point identifiers as the key, with a corresponding boolean value.
bool contains(const QString &pointIdentifier) const
True if specified entry exists in the table.
static unsigned int identifierIndex()
Return the current index for storage in case we need to reset it later while performing a Redo.
static void setIdentifierIndex(unsigned int identifierIndex)
Reset the current index while performing a Redo.
#define LOG4CPP_INFO_S(logger)