29 QgsLayoutSerializableObjectUndoCommand( QgsLayoutSerializableObject *
object,
const QString &text,
int id, QUndoCommand *parent
SIP_TRANSFERTHIS =
nullptr )
30 : QgsAbstractLayoutUndoCommand( text, id, parent )
34 bool mergeWith(
const QUndoCommand *command )
override
36 if ( command->id() == 0 )
39 const QgsLayoutSerializableObjectUndoCommand *
c =
dynamic_cast<const QgsLayoutSerializableObjectUndoCommand *
>( command );
45 if ( mObject->stringType() !=
c->mObject->stringType() )
48 setAfterState(
c->afterState() );
54 void saveState( QDomDocument &stateDoc )
const override
57 QDomElement documentElement = stateDoc.createElement( QStringLiteral(
"UndoState" ) );
58 mObject->writeXml( documentElement, stateDoc, QgsReadWriteContext() );
59 stateDoc.appendChild( documentElement );
61 void restoreState( QDomDocument &stateDoc )
override
68 mObject->readXml( stateDoc.documentElement().firstChild().toElement(), stateDoc, QgsReadWriteContext() );
69 mObject->layout()->project()->setDirty(
true );
74 QgsLayoutSerializableObject *mObject =
nullptr;
Base class for commands to undo/redo layout and layout object changes.
friend class QgsLayoutSerializableObjectUndoCommand
QgsAbstractLayoutUndoCommand * createCommand(const QString &text, int id, QUndoCommand *parent=nullptr) override
Creates a new layout undo command with the specified text and parent.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c