25 QgsLayoutMultiFrameUndoCommand::QgsLayoutMultiFrameUndoCommand(
QgsLayoutMultiFrame *frame,
const QString &text,
int id, QUndoCommand *parent )
27 , mFrameUuid( frame->uuid() )
28 , mLayout( frame->layout() )
29 , mItemType( frame->type() )
34 bool QgsLayoutMultiFrameUndoCommand::mergeWith(
const QUndoCommand *command )
36 if ( command->id() == 0 )
39 const QgsLayoutMultiFrameUndoCommand *
c =
dynamic_cast<const QgsLayoutMultiFrameUndoCommand *
>( command );
44 if ( c->multiFrameUuid() != multiFrameUuid() )
47 setAfterState( c->afterState() );
51 void QgsLayoutMultiFrameUndoCommand::saveState( QDomDocument &stateDoc )
const 54 QDomElement documentElement = stateDoc.createElement( QStringLiteral(
"ItemState" ) );
57 Q_ASSERT_X( item,
"QgsLayoutMultiFrameUndoCommand::saveState",
"could not retrieve item for saving state" );
60 stateDoc.appendChild( documentElement );
63 void QgsLayoutMultiFrameUndoCommand::restoreState( QDomDocument &stateDoc )
70 item = recreateItem( mItemType,
mLayout );
75 mLayout->project()->setDirty(
true );
85 QString QgsLayoutMultiFrameUndoCommand::multiFrameUuid()
const 90 QgsLayout *QgsLayoutMultiFrameUndoCommand::layout()
const 100 QgsLayoutMultiFrameDeleteUndoCommand::QgsLayoutMultiFrameDeleteUndoCommand(
QgsLayoutMultiFrame *item,
const QString &text,
int id, QUndoCommand *parent )
101 : QgsLayoutMultiFrameUndoCommand( item, text, id, parent )
106 bool QgsLayoutMultiFrameDeleteUndoCommand::mergeWith(
const QUndoCommand * )
111 void QgsLayoutMultiFrameDeleteUndoCommand::redo()
129 QgsLayoutMultiFrameAddItemCommand::QgsLayoutMultiFrameAddItemCommand(
QgsLayoutMultiFrame *
frame,
const QString &text,
int id, QUndoCommand *parent )
130 : QgsLayoutMultiFrameUndoCommand( frame, text, id, parent )
135 bool QgsLayoutMultiFrameAddItemCommand::containsChange()
const 140 bool QgsLayoutMultiFrameAddItemCommand::mergeWith(
const QUndoCommand * )
145 void QgsLayoutMultiFrameAddItemCommand::undo()
The class is used as a container of context for various read/write operations on other objects...
QgsLayoutMultiFrame * multiFrameByUuid(const QString &uuid, bool includeTemplateUuids=false) const
Returns the layout multiframe with matching uuid unique identifier, or a nullptr if a matching multif...
Base class for commands to undo/redo layout and layout object changes.
bool readXml(const QDomElement &itemElement, const QDomDocument &document, const QgsReadWriteContext &context, bool includeFrames=false)
Sets the item state from a DOM element.
Abstract base class for layout items with the ability to distribute the content to several frames (Qg...
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
static QgsLayoutItemRegistry * layoutItemRegistry()
Returns the application's layout item registry, used for layout item types.
const QgsLayout * layout() const
Returns the layout the object is attached to.
QPointer< QgsLayout > mLayout
void removeMultiFrame(QgsLayoutMultiFrame *multiFrame)
Removes a multiFrame from the layout (but does not delete it).
virtual void finalizeRestoreFromXml()
Called after all pending items have been restored from XML.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
QgsLayoutFrame * frame(int index) const
Returns the child frame at a specified index from the multiframe.
QgsLayoutMultiFrame * createMultiFrame(int type, QgsLayout *layout) const
Creates a new instance of a layout multiframe given the multiframe type, and target layout...
bool writeXml(QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context, bool includeFrames=false) const
Stores the multiframe state in a DOM element.