33 bool mergeWith(
const QUndoCommand *command )
override 35 if ( command->id() == 0 )
38 const QgsLayoutSerializableObjectUndoCommand *c =
dynamic_cast<const QgsLayoutSerializableObjectUndoCommand *
>( command );
44 if ( mObject->stringType() != c->mObject->stringType() )
53 void saveState( QDomDocument &stateDoc )
const override 56 QDomElement documentElement = stateDoc.createElement( QStringLiteral(
"UndoState" ) );
58 stateDoc.appendChild( documentElement );
67 mObject->readXml( stateDoc.documentElement().firstChild().toElement(), stateDoc,
QgsReadWriteContext() );
68 mObject->layout()->project()->setDirty(
true );
80 return new QgsLayoutSerializableObjectUndoCommand(
this, text,
id, parent );
The class is used as a container of context for various read/write operations on other objects...
virtual void restoreState(QDomDocument &stateDoc)=0
Restores the state of the object from the specified stateDoc.
Base class for commands to undo/redo layout and layout object changes.
QgsAbstractLayoutUndoCommand * createCommand(const QString &text, int id, QUndoCommand *parent=nullptr) override
Creates a new layout undo command with the specified text and parent.
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.
An interface for layout objects which can be stored and read from DOM elements.