QGIS API Documentation 3.41.0-Master (45a0abf3bec)
|
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. | |
QDomDocument | afterState () const |
Returns the after state for the layout. | |
QDomDocument | beforeState () const |
Returns the before state for the layout. | |
virtual bool | containsChange () const |
Returns true if both the before and after states are valid and different. | |
int | id () const override |
void | redo () override |
void | saveAfterState () |
Saves current layout state as after state. | |
void | saveBeforeState () |
Saves current layout state as before state. | |
void | undo () override |
Protected Member Functions | |
virtual void | restoreState (QDomDocument &stateDoc)=0 |
Restores the state of the object from the specified stateDoc. | |
virtual void | saveState (QDomDocument &stateDoc) const =0 |
Saves the state of the object to the specified stateDoc. | |
void | setAfterState (const QDomDocument &stateDoc) |
Manually sets the after state for the command. | |
Protected Attributes | |
bool | mFirstRun = true |
Flag to prevent the first redo() if the command is pushed to the undo stack. | |
Base class for commands to undo/redo layout and layout object changes.
Definition at line 33 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 74 of file qgslayoutundocommand.h.
|
inline |
Returns the before state for the layout.
Definition at line 67 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 46 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 107 of file qgslayoutundocommand.h.