23 QUndoCommand( text, parent ), mItem( item ), mFirstRun( true )
66 QDomElement documentElement = stateDoc.createElement(
"ComposerItemState" );
68 stateDoc.appendChild( documentElement );
76 mItem->
readXML( stateDoc.documentElement().firstChild().toElement(), stateDoc );
void redo()
Replays the command.
virtual bool readXML(const QDomElement &itemElem, const QDomDocument &doc)=0
sets state from Dom document
QgsComposerMergeCommand(Context c, QgsComposerItem *item, const QString &text)
A item that forms part of a map composition.
void savePreviousState()
Saves current item state as previous state.
~QgsComposerMergeCommand()
void saveState(QDomDocument &stateDoc) const
void restoreState(QDomDocument &stateDoc) const
bool containsChange() const
Returns true if previous state and after state are valid and different.
bool mergeWith(const QUndoCommand *command)
virtual ~QgsComposerItemCommand()
void saveAfterState()
Saves current item state as after state.
bool mFirstRun
Flag to prevent the first redo() if the command is pushed to the undo stack.
Undo command to undo/redo all composer item related changes.
QDomDocument mAfterState
XML containing the state after executing the command.
QgsComposerItem * mItem
Target item of the command.
const QgsComposerItem * item() const
static QgsProject * instance()
access to canonical QgsProject instance
QDomDocument afterState() const
QgsComposerItemCommand(QgsComposerItem *item, const QString &text, QUndoCommand *parent=0)
virtual bool writeXML(QDomElement &elem, QDomDocument &doc) const =0
stores state in Dom element
QDomDocument mPreviousState
XML that saves the state before executing the command.
void undo()
Reverses the command.