26using namespace Qt::StringLiterals;
32 QgsLayoutSerializableObjectUndoCommand( QgsLayoutSerializableObject *
object,
const QString &text,
int id, QUndoCommand *parent
SIP_TRANSFERTHIS =
nullptr )
33 : QgsAbstractLayoutUndoCommand( text, id, parent )
37 bool mergeWith(
const QUndoCommand *command )
override
39 if ( command->id() == 0 )
42 const QgsLayoutSerializableObjectUndoCommand *
c =
dynamic_cast<const QgsLayoutSerializableObjectUndoCommand *
>( command );
48 if ( mObject->stringType() !=
c->mObject->stringType() )
51 setAfterState(
c->afterState() );
56 void saveState( QDomDocument &stateDoc )
const override
59 QDomElement documentElement = stateDoc.createElement( u
"UndoState"_s );
60 mObject->writeXml( documentElement, stateDoc, QgsReadWriteContext() );
61 stateDoc.appendChild( documentElement );
63 void restoreState( QDomDocument &stateDoc )
override
70 mObject->readXml( stateDoc.documentElement().firstChild().toElement(), stateDoc, QgsReadWriteContext() );
71 mObject->layout()->project()->setDirty(
true );
75 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