QGIS API Documentation
3.20.0-Odense (decaadbb31)
|
Base class for commands to undo/redo layout and layout object changes. More...
#include <qgslayoutundocommand.h>
Public Member Functions | |
QgsAbstractLayoutUndoCommand (const QString &text, int id=0, QUndoCommand *parent=nullptr) | |
Constructor for QgsLayoutUndoCommand. More... | |
QDomDocument | afterState () const |
Returns the after state for the layout. More... | |
QDomDocument | beforeState () const |
Returns the before state for the layout. More... | |
virtual bool | containsChange () const |
Returns true if both the before and after states are valid and different. More... | |
int | id () const override |
void | redo () override |
void | saveAfterState () |
Saves current layout state as after state. More... | |
void | saveBeforeState () |
Saves current layout state as before state. More... | |
void | undo () override |
Protected Member Functions | |
virtual void | restoreState (QDomDocument &stateDoc)=0 |
Restores the state of the object from the specified stateDoc. More... | |
virtual void | saveState (QDomDocument &stateDoc) const =0 |
Saves the state of the object to the specified stateDoc. More... | |
void | setAfterState (const QDomDocument &stateDoc) |
Manually sets the after state for the command. More... | |
Protected Attributes | |
bool | mFirstRun = true |
Flag to prevent the first redo() if the command is pushed to the undo stack. More... | |
Base class for commands to undo/redo layout and layout object changes.
Definition at line 34 of file qgslayoutundocommand.h.
QgsAbstractLayoutUndoCommand::QgsAbstractLayoutUndoCommand | ( | const QString & | text, |
int | id = 0 , |
||
QUndoCommand * | parent = nullptr |
||
) |
Constructor for QgsLayoutUndoCommand.
The id argument can be used to specify an id number for the source event - this is used to determine whether QUndoCommand command compression can apply to the command.
Definition at line 21 of file qgslayoutundocommand.cpp.
|
inline |
Returns the after state for the layout.
Definition at line 75 of file qgslayoutundocommand.h.
|
inline |
Returns the before state for the layout.
Definition at line 68 of file qgslayoutundocommand.h.
|
virtual |
Returns true
if both the before and after states are valid and different.
Definition at line 53 of file qgslayoutundocommand.cpp.
|
inlineoverride |
Definition at line 47 of file qgslayoutundocommand.h.
|
override |
Definition at line 32 of file qgslayoutundocommand.cpp.
|
protectedpure virtual |
Restores the state of the object from the specified stateDoc.
Subclasses must implement this to handle restoring their current state from the encapsulated state.
void QgsAbstractLayoutUndoCommand::saveAfterState | ( | ) |
Saves current layout state as after state.
Definition at line 48 of file qgslayoutundocommand.cpp.
void QgsAbstractLayoutUndoCommand::saveBeforeState | ( | ) |
Saves current layout state as before state.
Definition at line 43 of file qgslayoutundocommand.cpp.
|
protectedpure virtual |
Saves the state of the object to the specified stateDoc.
Subclasses must implement this to handle encapsulating their current state into a DOM document.
|
protected |
Manually sets the after state for the command.
Generally this should not be called directly.
Definition at line 58 of file qgslayoutundocommand.cpp.
|
override |
Definition at line 26 of file qgslayoutundocommand.cpp.
|
protected |
Flag to prevent the first redo() if the command is pushed to the undo stack.
Definition at line 108 of file qgslayoutundocommand.h.