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