38 , mGridSettings( this )
43 setBackgroundBrush( Qt::NoBrush );
50 mUndoStack->blockCommands(
true );
52 deleteAndRemoveMultiFrames();
60 QList<QGraphicsItem *> itemList = items();
65 for ( QGraphicsItem *item : qgis::as_const( itemList ) )
67 if ( dynamic_cast< QgsLayoutItem * >( item ) && !dynamic_cast< QgsLayoutItemPage *>( item ) )
82 QDomDocument currentDoc;
85 QDomElement elem =
writeXml( currentDoc, context );
86 currentDoc.appendChild( elem );
88 std::unique_ptr< QgsLayout > newLayout = qgis::make_unique< QgsLayout >( mProject );
90 newLayout->loadFromTemplate( currentDoc, context,
true, &ok );
96 return newLayout.release();
104 mPageCollection->addPage( page );
105 mUndoStack->stack()->clear();
110 deleteAndRemoveMultiFrames();
113 const QList<QGraphicsItem *> itemList = items();
114 for ( QGraphicsItem *item : itemList )
118 if ( cItem && !pItem )
120 removeLayoutItemPrivate( cItem );
123 mItemsModel->clear();
125 mPageCollection->clear();
126 mUndoStack->stack()->clear();
136 return mItemsModel.get();
141 QList<QgsLayoutItem *> layoutItemList;
143 const QList<QGraphicsItem *> graphicsItemList = selectedItems();
144 for ( QGraphicsItem *item : graphicsItemList )
147 if ( layoutItem && ( includeLockedItems || !layoutItem->
isLocked() ) )
149 layoutItemList.push_back( layoutItem );
153 return layoutItemList;
172 const QList<QGraphicsItem *> selectedItemList = selectedItems();
173 for ( QGraphicsItem *item : selectedItemList )
175 if (
QgsLayoutItem *layoutItem = dynamic_cast<QgsLayoutItem *>( item ) )
177 layoutItem->setSelected(
false );
186 bool result = mItemsModel->reorderItemUp( item );
187 if ( result && !deferUpdate )
199 bool result = mItemsModel->reorderItemDown( item );
200 if ( result && !deferUpdate )
212 bool result = mItemsModel->reorderItemToTop( item );
213 if ( result && !deferUpdate )
225 bool result = mItemsModel->reorderItemToBottom( item );
226 if ( result && !deferUpdate )
237 QList<QgsLayoutItem *> itemList;
241 if ( item->uuid() == uuid )
243 else if ( includeTemplateUuids && item->mTemplateUuid == uuid )
252 QList<QgsLayoutItem *> itemList;
256 if ( item->mTemplateUuid == uuid )
265 const QList<QGraphicsItem *> itemList = items();
266 for ( QGraphicsItem *item : itemList )
269 if ( layoutItem && layoutItem->
id() == id )
281 if ( mf->uuid() == uuid )
283 else if ( includeTemplateUuids && mf->mTemplateUuid == uuid )
298 const QList<QGraphicsItem *> itemList = items( position, Qt::IntersectsItemShape, Qt::DescendingOrder );
300 bool foundBelowItem =
false;
301 for ( QGraphicsItem *graphicsItem : itemList )
305 if ( layoutItem && !paperItem )
309 if ( ( ! belowItem || foundBelowItem ) && ( !ignoreLocked || !layoutItem->
isLocked() ) )
315 if ( layoutItem == belowItem )
318 foundBelowItem =
true;
358 return *mRenderContext;
363 return *mRenderContext;
368 return *mReportContext;
373 return *mReportContext;
379 mPageCollection->redraw();
384 return mPageCollection->guides();
389 return mPageCollection->guides();
397 if ( mReportContext->
layer() )
406 mCustomProperties.
setValue( key, value );
408 if ( key.startsWith( QLatin1String(
"variable" ) ) )
414 return mCustomProperties.
value( key, defaultValue );
419 mCustomProperties.
remove( key );
424 return mCustomProperties.
keys();
434 QList< QgsLayoutItemMap * > maps;
437 double largestMapArea = 0;
440 double area = map->rect().width() * map->rect().height();
441 if ( area > largestMapArea )
443 largestMapArea = area;
452 mWorldFileMapId = map ? map->
uuid() : QString();
458 return mPageCollection.get();
463 return mPageCollection.get();
472 Q_FOREACH (
const QGraphicsItem *item, items() )
479 if ( !isPage || !ignorePages )
487 itemBounds = layoutItem->mapToScene( layoutItem->rect() ).boundingRect();
490 itemBounds = item->sceneBoundingRect();
492 if ( bounds.isValid() )
493 bounds = bounds.united( itemBounds );
499 if ( bounds.isValid() && margin > 0.0 )
502 double maxWidth = mPageCollection->maximumPageWidth();
503 bounds.adjust( -maxWidth * margin, -maxWidth * margin, maxWidth * margin, maxWidth * margin );
516 const QList<QGraphicsItem *> itemList = items();
517 for ( QGraphicsItem *item : itemList )
522 if ( visibleOnly && !layoutItem->isVisible() )
526 if ( bounds.isValid() )
527 bounds = bounds.united( item->sceneBoundingRect() );
529 bounds = item->sceneBoundingRect();
538 addLayoutItemPrivate( item );
542 undoText = tr(
"Create %1" ).arg( metadata->visibleName() );
546 undoText = tr(
"Create Item" );
548 if ( !mUndoStack->isBlocked() )
554 std::unique_ptr< QgsLayoutItemDeleteUndoCommand > deleteCommand;
555 if ( !mUndoStack->isBlocked() )
557 mUndoStack->beginMacro( tr(
"Delete Items" ) );
560 removeLayoutItemPrivate( item );
563 mUndoStack->push( deleteCommand.release() );
564 mUndoStack->endMacro();
573 if ( !mMultiFrames.contains( multiFrame ) )
574 mMultiFrames << multiFrame;
579 mMultiFrames.removeAll( multiFrame );
589 QFile templateFile( path );
590 if ( !templateFile.open( QIODevice::WriteOnly | QIODevice::Truncate ) )
595 QDomDocument saveDocument;
596 QDomElement elem =
writeXml( saveDocument, context );
597 saveDocument.appendChild( elem );
599 if ( templateFile.write( saveDocument.toByteArray() ) == -1 )
610 QList< QgsLayoutItem * > result;
630 QDomNodeList itemsNodes = doc.elementsByTagName( QStringLiteral(
"LayoutItem" ) );
631 for (
int i = 0; i < itemsNodes.count(); ++i )
633 QDomNode itemNode = itemsNodes.at( i );
634 if ( itemNode.isElement() )
636 itemNode.toElement().removeAttribute( QStringLiteral(
"uuid" ) );
639 QDomNodeList multiFrameNodes = doc.elementsByTagName( QStringLiteral(
"LayoutMultiFrame" ) );
640 for (
int i = 0; i < multiFrameNodes.count(); ++i )
642 QDomNode multiFrameNode = multiFrameNodes.at( i );
643 if ( multiFrameNode.isElement() )
645 multiFrameNode.toElement().removeAttribute( QStringLiteral(
"uuid" ) );
646 QDomNodeList frameNodes = multiFrameNode.toElement().elementsByTagName( QStringLiteral(
"childFrame" ) );
647 QDomNode itemNode = frameNodes.at( i );
648 if ( itemNode.isElement() )
650 itemNode.toElement().removeAttribute( QStringLiteral(
"uuid" ) );
658 QDomElement layoutElem = doc.documentElement();
659 if ( layoutElem.isNull() )
664 bool loadOk =
readXml( layoutElem, doc, context );
684 return mUndoStack.get();
689 return mUndoStack.get();
704 void saveState( QDomDocument &stateDoc )
const override 707 QDomElement documentElement = stateDoc.createElement( QStringLiteral(
"UndoState" ) );
709 stateDoc.appendChild( documentElement );
712 void restoreState( QDomDocument &stateDoc )
override 719 mLayout->readXmlLayoutSettings( stateDoc.documentElement(), stateDoc,
QgsReadWriteContext() );
720 mLayout->project()->setDirty(
true );
736 if ( items.size() < 2 )
742 mUndoStack->beginMacro( tr(
"Group Items" ) );
746 itemGroup->addItem( item );
751 std::unique_ptr< QgsLayoutItemGroupUndoCommand >
c(
new QgsLayoutItemGroupUndoCommand( QgsLayoutItemGroupUndoCommand::Grouped, returnGroup,
this, tr(
"Group Items" ) ) );
752 mUndoStack->push( c.release() );
753 mProject->setDirty(
true );
755 mUndoStack->endMacro();
762 QList<QgsLayoutItem *> ungroupedItems;
765 return ungroupedItems;
768 mUndoStack->beginMacro( tr(
"Ungroup Items" ) );
771 std::unique_ptr< QgsLayoutItemGroupUndoCommand >
c(
new QgsLayoutItemGroupUndoCommand( QgsLayoutItemGroupUndoCommand::Ungrouped, group,
this, tr(
"Ungroup Items" ) ) );
772 mUndoStack->push( c.release() );
774 mProject->setDirty(
true );
776 ungroupedItems = group->
items();
780 mUndoStack->endMacro();
782 return ungroupedItems;
787 mUndoStack->blockCommands(
true );
788 mPageCollection->beginPageSizeChange();
790 mPageCollection->reflow();
791 mPageCollection->endPageSizeChange();
792 mUndoStack->blockCommands(
false );
796 void QgsLayout::writeXmlLayoutSettings( QDomElement &element, QDomDocument &document,
const QgsReadWriteContext & )
const 798 mCustomProperties.writeXml( element, document );
800 element.setAttribute( QStringLiteral(
"worldFileMap" ), mWorldFileMapId );
801 element.setAttribute( QStringLiteral(
"printResolution" ), mRenderContext->dpi() );
806 QDomElement element = document.createElement( QStringLiteral(
"Layout" ) );
809 return object->writeXml( element, document, context );
812 save( &mGridSettings );
813 save( mPageCollection.get() );
816 const QList<QGraphicsItem *> itemList = items();
817 for (
const QGraphicsItem *graphicsItem : itemList )
819 if (
const QgsLayoutItem *item = dynamic_cast< const QgsLayoutItem *>( graphicsItem ) )
824 item->writeXml( element, document, context );
831 if ( mf->frameCount() > 0 )
832 mf->writeXml( element, document, context );
835 writeXmlLayoutSettings( element, document, context );
839 bool QgsLayout::readXmlLayoutSettings(
const QDomElement &layoutElement,
const QDomDocument &,
const QgsReadWriteContext & )
841 mCustomProperties.readXml( layoutElement );
843 mWorldFileMapId = layoutElement.attribute( QStringLiteral(
"worldFileMap" ) );
844 mRenderContext->setDpi( layoutElement.attribute( QStringLiteral(
"printResolution" ), QStringLiteral(
"300" ) ).toDouble() );
854 mItemsModel->rebuildZList();
857 void QgsLayout::removeLayoutItemPrivate(
QgsLayoutItem *item )
859 mItemsModel->setItemRemoved( item );
866 emit itemRemoved( item );
872 void QgsLayout::deleteAndRemoveMultiFrames()
874 qDeleteAll( mMultiFrames );
875 mMultiFrames.clear();
878 QPointF QgsLayout::minPointFromXml(
const QDomElement &elem )
const 880 double minX = std::numeric_limits<double>::max();
881 double minY = std::numeric_limits<double>::max();
882 const QDomNodeList itemList = elem.elementsByTagName( QStringLiteral(
"LayoutItem" ) );
884 for (
int i = 0; i < itemList.size(); ++i )
886 const QDomElement currentItemElem = itemList.at( i ).toElement();
891 minX = std::min( minX, layoutPoint.x() );
892 minY = std::min( minY, layoutPoint.y() );
895 return found ? QPointF( minX, minY ) : QPointF( 0, 0 );
900 int counter = mItemsModel->zOrderListSize();
901 const QList<QgsLayoutItem *> zOrderList = mItemsModel->zOrderList();
903 if ( addUndoCommands )
905 mUndoStack->beginMacro( tr(
"Change Item Stacking" ) );
911 if ( addUndoCommands )
913 mUndoStack->beginCommand( currentItem, QString() );
915 currentItem->setZValue( counter );
916 if ( addUndoCommands )
918 mUndoStack->endCommand();
923 if ( addUndoCommands )
925 mUndoStack->endMacro();
931 if ( layoutElement.nodeName() != QStringLiteral(
"Layout" ) )
938 return object->readXml( layoutElement, document, context );
941 blockSignals(
true );
942 readXmlLayoutSettings( layoutElement, document, context );
943 blockSignals(
false );
945 restore( mPageCollection.get() );
946 restore( &mSnapper );
947 restore( &mGridSettings );
957 QList< QgsLayoutItem * > newItems;
958 QList< QgsLayoutMultiFrame * > newMultiFrames;
963 int zOrderOffset = mItemsModel->zOrderListSize();
965 QPointF pasteShiftPos;
972 QPointF minItemPos = minPointFromXml( parentElement );
975 pasteShiftPos = *position - minItemPos;
978 pageNumber = mPageCollection->pageNumberForPoint( *position );
984 const QDomNodeList multiFrameList = parentElement.elementsByTagName( QStringLiteral(
"LayoutMultiFrame" ) );
985 for (
int i = 0; i < multiFrameList.size(); ++i )
987 const QDomElement multiFrameElem = multiFrameList.at( i ).toElement();
988 const int itemType = multiFrameElem.attribute( QStringLiteral(
"type" ) ).toInt();
995 mf->readXml( multiFrameElem, document, context );
998 mf->setCreateUndoCommands(
true );
1013 newMultiFrames << m;
1016 const QDomNodeList layoutItemList = parentElement.childNodes();
1017 for (
int i = 0; i < layoutItemList.size(); ++i )
1019 const QDomElement currentItemElem = layoutItemList.at( i ).toElement();
1020 if ( currentItemElem.nodeName() != QStringLiteral(
"LayoutItem" ) )
1023 const int itemType = currentItemElem.attribute( QStringLiteral(
"type" ) ).toInt();
1031 item->readXml( currentItemElem, document, context );
1037 item->attemptMove( posOnPage,
true,
false, pageNumber );
1041 item->attemptMoveBy( pasteShiftPos.x(), pasteShiftPos.y() );
1047 layoutItem->setZValue( layoutItem->zValue() + zOrderOffset );
1048 newItems << layoutItem;
1061 mf->finalizeRestoreFromXml();
1066 item->mTemplateUuid.clear();
1070 mf->mTemplateUuid.clear();
1076 mItemsModel->rebuildZList();
void setDirty(bool b=true)
Flag the project as dirty (modified).
The class is used as a container of context for various read/write operations on other objects...
void removeItems()
Removes all items from the group (but does not delete them).
QList< QgsLayoutItem * > items() const
Returns a list of items contained by the group.
void setSelectedItem(QgsLayoutItem *item)
Clears any selected items and sets item as the current selection.
bool raiseItem(QgsLayoutItem *item, bool deferUpdate=false)
Raises an item up the z-order.
QgsLayoutGuideCollection & guides()
Returns a reference to the layout's guide collection, which manages page snap guides.
Base class for graphical items within a QgsLayout.
int type() const override
Returns a unique graphics item type identifier.
QList< QgsLayoutItem * > addItemsFromXml(const QDomElement &parentElement, const QDomDocument &document, const QgsReadWriteContext &context, QPointF *position=nullptr, bool pasteInPlace=false)
Add items from an XML representation to the layout.
Base class for commands to undo/redo layout and layout object changes.
QgsLayoutUndoStack * undoStack()
Returns a pointer to the layout's undo stack, which manages undo/redo states for the layout and it's ...
friend class QgsLayoutModel
QList< QgsLayoutMultiFrame * > multiFrames() const
Returns a list of multi frames contained in the layout.
QRectF layoutBounds(bool ignorePages=false, double margin=0.0) const
Calculates the bounds of all non-gui items in the layout.
Stores information relating to the current reporting context for a layout.
QStringList customProperties() const
Returns list of keys stored in custom properties for the layout.
virtual bool readXml(const QDomElement &layoutElement, const QDomDocument &document, const QgsReadWriteContext &context)
Sets the collection's state from a DOM element.
An undo stack for QgsLayouts.
void loadFromSettings()
Loads grid settings from the application layout settings.
double length() const
Returns the length of the measurement.
A container for grouping several QgsLayoutItems.
QgsLayoutMeasurement convertFromLayoutUnits(double length, QgsUnitTypes::LayoutUnit unit) const
Converts a length measurement from the layout's native units to a specified target unit...
QgsLayoutItemMap * referenceMap() const
Returns the map item which will be used to generate corresponding world files when the layout is expo...
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...
static QDomDocument convertCompositionTemplate(const QDomDocument &document, QgsProject *project)
Convert a composition template document to a layout template.
virtual void setSelected(bool selected)
Sets whether the item should be selected.
static QgsExpressionContextScope * projectScope(const QgsProject *project)
Creates a new scope which contains variables and functions relating to a QGIS project.
void setUnits(QgsUnitTypes::LayoutUnit units)
Sets the native measurement units for the layout.
QList< QgsLayoutItem * > ungroupItems(QgsLayoutItemGroup *group)
Ungroups items by removing them from an item group and removing the group from the layout...
void updateBounds()
Updates the scene bounds of the layout.
const QgsLayoutMeasurementConverter & measurementConverter() const
Returns the layout measurement converter to be used in the layout.
QgsLayoutRenderContext & renderContext()
Returns a reference to the layout's render context, which stores information relating to the current ...
void remove(const QString &key)
Remove a key (entry) from the store.
QList< QgsLayoutItem * > loadFromTemplate(const QDomDocument &document, const QgsReadWriteContext &context, bool clearExisting=true, bool *ok=nullptr)
Load a layout template document.
Abstract base class for layout items with the ability to distribute the content to several frames (Qg...
void layoutItems(QList< T * > &itemList) const
Returns a list of layout items of a specific type.
QgsLayoutItem * itemByUuid(const QString &uuid, bool includeTemplateUuids=false) const
Returns the layout item with matching uuid unique identifier, or a nullptr if a matching item could n...
This class provides a method of storing points, consisting of an x and y coordinate, for use in QGIS layouts.
void removeCustomProperty(const QString &key)
Remove a custom property from the layout.
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
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
Returns value for the given key. If the key is not stored, default value will be used.
void deselectAll()
Clears any selected items in the layout.
QgsLayoutItem * itemById(const QString &id) const
Returns a layout item given its id.
void updateZValues(bool addUndoCommands=true)
Resets the z-values of items based on their position in the internal z order list.
QgsLayout * clone() const
Creates a clone of the layout.
QgsLayoutMeasurement convert(QgsLayoutMeasurement measurement, QgsUnitTypes::LayoutUnit targetUnits) const
Converts a measurement from one unit to another.
static QgsLayoutItemRegistry * layoutItemRegistry()
Returns the application's layout item registry, used for layout item types.
Layout graphical items for displaying a map.
void setValue(const QString &key, const QVariant &value)
Add an entry to the store. If the entry with the keys exists already, it will be overwritten.
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context...
void variablesChanged()
Emitted whenever the expression variables stored in the layout have been changed. ...
This class provides a method of storing measurements for use in QGIS layouts using a variety of diffe...
static bool isCompositionTemplate(const QDomDocument &document)
Check if the given document is a composition template.
static Q_INVOKABLE QgsUnitTypes::LayoutUnit decodeLayoutUnit(const QString &string, bool *ok=nullptr)
Decodes a layout unit from a string.
void refresh()
Forces the layout, and all items contained within it, to refresh.
QgsLayoutPageCollection * pageCollection()
Returns a pointer to the layout's page collection, which stores and manages page items in the layout...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
QStringList keys() const
Returns list of stored keys.
QList< QgsLayoutItem * > selectedLayoutItems(bool includeLockedItems=true)
Returns list of selected layout items.
bool saveAsTemplate(const QString &path, const QgsReadWriteContext &context) const
Saves the layout as a template at the given file path.
void selectedItemChanged(QgsLayoutItem *selected)
Emitted whenever the selected item changes.
virtual void cleanup()
Called just before a batch of items are deleted, allowing them to run cleanup tasks.
void removeMultiFrame(QgsLayoutMultiFrame *multiFrame)
Removes a multiFrame from the layout (but does not delete it).
Stores and manages the snap guides used by a layout.
Reads and writes project states.
virtual QString uuid() const
Returns the item identification string.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
A manager for a collection of pages in a layout.
bool lowerItem(QgsLayoutItem *item, bool deferUpdate=false)
Lowers an item down the z-order.
static Q_INVOKABLE QString encodeUnit(QgsUnitTypes::DistanceUnit unit)
Encodes a distance unit to a string.
QVariant customProperty(const QString &key, const QVariant &defaultValue=QVariant()) const
Read a custom property from the layout.
QgsLayoutModel * itemsModel()
Returns the items model attached to the layout.
friend class QgsLayoutItemAddItemCommand
virtual void finalizeRestoreFromXml()
Called after all pending items have been restored from XML.
QgsLayoutReportContext & reportContext()
Returns a reference to the layout's report context, which stores information relating to the current ...
friend class QgsLayoutUndoCommand
QgsExpressionContext createExpressionContext() const override
Creates an expression context relating to the layout's current state.
int page() const
Returns the page the item is currently on, with the first page returning 0.
bool moveItemToBottom(QgsLayoutItem *item, bool deferUpdate=false)
Lowers an item down to the bottom of the z-order.
void clear()
Clears the layout.
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
void removeLayoutItem(QgsLayoutItem *item)
Removes an item from the layout.
static QgsExpressionContextScope * layoutScope(const QgsLayout *layout)
Creates a new scope which contains variables and functions relating to a QgsLayout layout...
void refreshed()
Is emitted when the layout has been refreshed and items should also be refreshed and updated...
friend class QgsLayoutItemGroupUndoCommand
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
void addLayoutItem(QgsLayoutItem *item)
Adds an item to the layout.
Stores information relating to the current rendering settings for a layout.
QRectF pageItemBounds(int page, bool visibleOnly=false) const
Returns the bounding box of the items contained on a specified page.
void setReferenceMap(QgsLayoutItemMap *map)
Sets the map item which will be used to generate corresponding world files when the layout is exporte...
An interface for layout objects which can be stored and read from DOM elements.
void initializeDefaults()
Initializes an empty layout, e.g.
void setCustomProperty(const QString &key, const QVariant &value)
Set a custom property for the layout.
LayoutUnit
Layout measurement units.
QString id() const
Returns the item's ID name.
QgsLayoutItemGroup * groupItems(const QList< QgsLayoutItem * > &items)
Creates a new group from a list of layout items and adds the group to the layout. ...
QgsAbstractLayoutUndoCommand * createCommand(const QString &text, int id=0, QUndoCommand *parent=nullptr) override
Creates a new layout undo command with the specified text and parent.
void setPageSize(const QgsLayoutSize &size)
Sets the size of the page.
A model for items attached to a layout.
virtual QDomElement writeXml(QDomDocument &document, const QgsReadWriteContext &context) const
Returns the layout's state encapsulated in a DOM element.
Manages snapping grids and preset snap lines in a layout, and handles snapping points to the nearest ...
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
bool isLocked() const
Returns true if the item is locked, and cannot be interacted with using the mouse.
This class provides a method of storing sizes, consisting of a width and height, for use in QGIS layo...
void changed()
Is emitted when properties of the layout change.
bool moveItemToTop(QgsLayoutItem *item, bool deferUpdate=false)
Raises an item up to the top of the z-order.
void reloadSettings()
Refreshes the layout when global layout related options change.
void addMultiFrame(QgsLayoutMultiFrame *multiFrame)
Adds a multiFrame to the layout.
QgsLayout(QgsProject *project)
Construct a new layout linked to the specified project.
QgsLayoutItem * itemByTemplateUuid(const QString &uuid) const
Returns the layout item with matching template uuid unique identifier, or a nullptr if a matching ite...
QgsProject * project() const
The project associated with the layout.
QgsVectorLayer * layer() const
Returns the vector layer associated with the layout's context.
QgsLayoutItem * layoutItemAt(QPointF position, bool ignoreLocked=false) const
Returns the topmost layout item at a specified position.
static QgsLayoutPoint decodePoint(const QString &string)
Decodes a point from a string.
double convertToLayoutUnits(QgsLayoutMeasurement measurement) const
Converts a measurement into the layout's native units.
Item representing the paper in a layout.
friend class QgsLayoutItemDeleteUndoCommand