24 QgsLayoutItemGroupUndoCommand::QgsLayoutItemGroupUndoCommand( State s,
QgsLayoutItemGroup *group,
QgsLayout *layout,
const QString &text, QUndoCommand *parent )
25 : QUndoCommand( text, parent )
26 , mGroupUuid( group->uuid() )
30 const QList< QgsLayoutItem * >
items = group->
items();
33 mItemUuids.insert( i->uuid() );
37 void QgsLayoutItemGroupUndoCommand::redo()
47 void QgsLayoutItemGroupUndoCommand::undo()
57 void QgsLayoutItemGroupUndoCommand::switchState()
59 if ( mState == Grouped )
63 Q_ASSERT_X( group,
"QgsLayoutItemGroupUndoCommand::switchState",
"Could not find group" );
65 mLayout->removeLayoutItemPrivate( group );
75 mLayout->addLayoutItemPrivate( group );
78 for (
const QString &childUuid : qgis::as_const( mItemUuids ) )
86 mLayout->project()->setDirty(
true );
void removeItems()
Removes all items from the group (but does not delete them).
QgsLayoutItemGroup(QgsLayout *layout)
Constructor for QgsLayoutItemGroup, belonging to the specified layout.
Base class for graphical items within a QgsLayout.
A container for grouping several QgsLayoutItems.
void addItem(QgsLayoutItem *item)
Adds an item to the group.
QList< QgsLayoutItem * > items() const
Returns a list of items contained by the group.
QPointer< QgsLayout > mLayout
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.