26using namespace Qt::StringLiterals;
33 QgsLayoutSerializableObjectUndoCommand( QgsLayoutSerializableObject *
object,
const QString &text,
int id, QUndoCommand *parent
SIP_TRANSFERTHIS =
nullptr )
34 : QgsAbstractLayoutUndoCommand( text, id, parent )
38 bool mergeWith(
const QUndoCommand *command )
override
40 if ( command->id() == 0 )
43 const QgsLayoutSerializableObjectUndoCommand *
c =
dynamic_cast<const QgsLayoutSerializableObjectUndoCommand *
>( command );
49 if ( mObject->stringType() !=
c->mObject->stringType() )
52 setAfterState(
c->afterState() );
58 void saveState( QDomDocument &stateDoc )
const override
61 QDomElement documentElement = stateDoc.createElement( u
"UndoState"_s );
62 mObject->writeXml( documentElement, stateDoc, QgsReadWriteContext() );
63 stateDoc.appendChild( documentElement );
65 void restoreState( QDomDocument &stateDoc )
override
72 mObject->readXml( stateDoc.documentElement().firstChild().toElement(), stateDoc, QgsReadWriteContext() );
73 mObject->layout()->project()->setDirty(
true );
78 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