QGIS API Documentation  2.99.0-Master (19b062c)
Public Types | Public Slots | Signals | Public Member Functions | Friends | List of all members
QgsLayout Class Reference

Base class for layouts, which can contain items such as maps, labels, scalebars, etc. More...

#include <qgslayout.h>

Inheritance diagram for QgsLayout:
Inheritance graph
[legend]

Public Types

enum  ZValues {
  ZPage = 0, ZItem = 1, ZGrid = 9997, ZGuide = 9998,
  ZSmartGuide = 9999, ZMouseHandles = 10000, ZViewTool = 10001, ZSnapIndicator = 10002
}
 Preset item z-values, to ensure correct stacking. More...
 

Public Slots

void refresh ()
 Forces the layout, and all items contained within it, to refresh. More...
 
void updateBounds ()
 Updates the scene bounds of the layout. More...
 

Signals

void refreshed ()
 Is emitted when the layout has been refreshed and items should also be refreshed and updated. More...
 
void selectedItemChanged (QgsLayoutItem *selected)
 Emitted whenever the selected item changes. More...
 
void variablesChanged ()
 Emitted whenever the expression variables stored in the layout have been changed. More...
 

Public Member Functions

 QgsLayout (QgsProject *project)
 Construct a new layout linked to the specified project. More...
 
 ~QgsLayout ()
 
void addLayoutItem (QgsLayoutItem *item)
 Adds an item to the layout. More...
 
void addMultiFrame (QgsLayoutMultiFrame *multiFrame)
 Adds a multiFrame to the layout. More...
 
QgsLayoutContextcontext ()
 Returns a reference to the layout's context, which stores information relating to the current context and rendering settings for the layout. More...
 
const QgsLayoutContextcontext () const
 Returns a reference to the layout's context, which stores information relating to the current context and rendering settings for the layout. More...
 
QgsLayoutMeasurement convertFromLayoutUnits (const double length, const QgsUnitTypes::LayoutUnit unit) const
 Converts a length measurement from the layout's native units to a specified target unit. More...
 
QgsLayoutSize convertFromLayoutUnits (const QSizeF &size, const QgsUnitTypes::LayoutUnit unit) const
 Converts a size from the layout's native units to a specified target unit. More...
 
QgsLayoutPoint convertFromLayoutUnits (const QPointF &point, const QgsUnitTypes::LayoutUnit unit) const
 Converts a point from the layout's native units to a specified target unit. More...
 
double convertToLayoutUnits (const QgsLayoutMeasurement &measurement) const
 Converts a measurement into the layout's native units. More...
 
QSizeF convertToLayoutUnits (const QgsLayoutSize &size) const
 Converts a size into the layout's native units. More...
 
QPointF convertToLayoutUnits (const QgsLayoutPoint &point) const
 Converts a point into the layout's native units. More...
 
QgsAbstractLayoutUndoCommandcreateCommand (const QString &text, int id=0, QUndoCommand *parent=nullptr) override
 Creates a new layout undo command with the specified text and parent. More...
 
QgsExpressionContext createExpressionContext () const override
 Creates an expression context relating to the layout's current state. More...
 
QStringList customProperties () const
 Return list of keys stored in custom properties for the layout. More...
 
QVariant customProperty (const QString &key, const QVariant &defaultValue=QVariant()) const
 Read a custom property from the layout. More...
 
void deselectAll ()
 Clears any selected items in the layout. More...
 
QgsLayoutExporterexporter ()
 Returns the layout's exporter, which is used for rendering the layout and exporting to various formats. More...
 
QgsLayoutGridSettingsgridSettings ()
 Returns a reference to the layout's grid settings, which stores settings relating to grid appearance, spacing and offsets. More...
 
const QgsLayoutGridSettingsgridSettings () const
 Returns a reference to the layout's grid settings, which stores settings relating to grid appearance, spacing and offsets. More...
 
QgsLayoutItemGroupgroupItems (const QList< QgsLayoutItem *> &items)
 Creates a new group from a list of layout items and adds the group to the layout. More...
 
QgsLayoutGuideCollectionguides ()
 Returns a reference to the layout's guide collection, which manages page snap guides. More...
 
const QgsLayoutGuideCollectionguides () const
 Returns a reference to the layout's guide collection, which manages page snap guides. More...
 
void initializeDefaults ()
 Initializes an empty layout, e.g. More...
 
QgsLayoutItemitemByUuid (const QString &uuid)
 Returns the layout item with matching uuid unique identifier, or a nullptr if a matching item could not be found. More...
 
QgsLayoutModelitemsModel ()
 Returns the items model attached to the layout. More...
 
QRectF layoutBounds (bool ignorePages=false, double margin=0.0) const
 Calculates the bounds of all non-gui items in the layout. More...
 
QgsLayoutItemlayoutItemAt (QPointF position, const bool ignoreLocked=false) const
 Returns the topmost layout item at a specified position. More...
 
QgsLayoutItemlayoutItemAt (QPointF position, const QgsLayoutItem *belowItem, const bool ignoreLocked=false) const
 Returns the topmost composer item at a specified position which is below a specified item. More...
 
template<class T >
void layoutItems (QList< T *> &itemList)
 Returns a list of layout items of a specific type. More...
 
bool lowerItem (QgsLayoutItem *item, bool deferUpdate=false)
 Lowers an item down the z-order. More...
 
bool moveItemToBottom (QgsLayoutItem *item, bool deferUpdate=false)
 Lowers an item down to the bottom of the z-order. More...
 
bool moveItemToTop (QgsLayoutItem *item, bool deferUpdate=false)
 Raises an item up to the top of the z-order. More...
 
QgsLayoutMultiFramemultiFrameByUuid (const QString &uuid) const
 Returns the layout multiframe with matching uuid unique identifier, or a nullptr if a matching multiframe could not be found. More...
 
QList< QgsLayoutMultiFrame *> multiFrames () const
 Returns a list of multi frames contained in the layout. More...
 
QString name () const
 Returns the layout's name. More...
 
QgsLayoutPageCollectionpageCollection ()
 Returns a pointer to the layout's page collection, which stores and manages page items in the layout. More...
 
const QgsLayoutPageCollectionpageCollection () const
 Returns a pointer to the layout's page collection, which stores and manages page items in the layout. More...
 
QgsProjectproject () const
 The project associated with the layout. More...
 
bool raiseItem (QgsLayoutItem *item, bool deferUpdate=false)
 Raises an item up the z-order. More...
 
bool readXml (const QDomElement &layoutElement, const QDomDocument &document, const QgsReadWriteContext &context)
 Sets the collection's state from a DOM element. More...
 
QgsLayoutItemMapreferenceMap () const
 Returns the map item which will be used to generate corresponding world files when the layout is exported. More...
 
void removeCustomProperty (const QString &key)
 Remove a custom property from the layout. More...
 
void removeLayoutItem (QgsLayoutItem *item)
 Removes an item from the layout. More...
 
void removeMultiFrame (QgsLayoutMultiFrame *multiFrame)
 Removes a multiFrame from the layout (but does not delete it). More...
 
QList< QgsLayoutItem * > selectedLayoutItems (const bool includeLockedItems=true)
 Returns list of selected layout items. More...
 
void setCustomProperty (const QString &key, const QVariant &value)
 Set a custom property for the layout. More...
 
void setName (const QString &name)
 Sets the layout's name. More...
 
void setReferenceMap (QgsLayoutItemMap *map)
 Sets the map item which will be used to generate corresponding world files when the layout is exported. More...
 
void setSelectedItem (QgsLayoutItem *item)
 Clears any selected items and sets item as the current selection. More...
 
void setUnits (QgsUnitTypes::LayoutUnit units)
 Sets the native measurement units for the layout. More...
 
QgsLayoutSnappersnapper ()
 Returns a reference to the layout's snapper, which stores handles layout snap grids and lines and snapping points to the nearest matching point. More...
 
const QgsLayoutSnappersnapper () const
 Returns a reference to the layout's snapper, which stores handles layout snap grids and lines and snapping points to the nearest matching point. More...
 
QgsLayoutUndoStackundoStack ()
 Returns a pointer to the layout's undo stack, which manages undo/redo states for the layout and it's associated objects. More...
 
const QgsLayoutUndoStackundoStack () const
 Returns a pointer to the layout's undo stack, which manages undo/redo states for the layout and it's associated objects. More...
 
QList< QgsLayoutItem * > ungroupItems (QgsLayoutItemGroup *group)
 Ungroups items by removing them from an item group and removing the group from the layout. More...
 
QgsUnitTypes::LayoutUnit units () const
 Returns the native units for the layout. More...
 
void updateZValues (const bool addUndoCommands=true)
 Resets the z-values of items based on their position in the internal z order list. More...
 
QDomElement writeXml (QDomDocument &document, const QgsReadWriteContext &context) const
 Returns the layout's state encapsulated in a DOM element. More...
 
- Public Member Functions inherited from QgsExpressionContextGenerator
virtual ~QgsExpressionContextGenerator ()=default
 
- Public Member Functions inherited from QgsLayoutUndoObjectInterface
virtual ~QgsLayoutUndoObjectInterface ()=default
 Destructor for QgsLayoutUndoObjectInterface. More...
 

Friends

class QgsLayoutItemAddItemCommand
 
class QgsLayoutItemDeleteUndoCommand
 
class QgsLayoutItemGroupUndoCommand
 
class QgsLayoutItemUndoCommand
 
class QgsLayoutModel
 
class QgsLayoutMultiFrame
 
class QgsLayoutUndoCommand
 

Detailed Description

Base class for layouts, which can contain items such as maps, labels, scalebars, etc.

Since
QGIS 3.0

Definition at line 40 of file qgslayout.h.

Member Enumeration Documentation

◆ ZValues

Preset item z-values, to ensure correct stacking.

Enumerator
ZPage 

Z-value for page (paper) items.

ZItem 

Minimum z value for items.

ZGrid 

Z-value for page grids.

ZGuide 

Z-value for page guides.

ZSmartGuide 

Z-value for smart (item bounds based) guides.

ZMouseHandles 

Z-value for mouse handles.

ZViewTool 

Z-value for temporary view tool items.

ZSnapIndicator 

Z-value for snapping indicator.

Definition at line 47 of file qgslayout.h.

Constructor & Destructor Documentation

◆ QgsLayout()

QgsLayout::QgsLayout ( QgsProject project)

Construct a new layout linked to the specified project.

If the layout is a "new" layout (as opposed to a layout which will restore a previous state from XML) then initializeDefaults() should be called on the new layout.

Definition at line 29 of file qgslayout.cpp.

◆ ~QgsLayout()

QgsLayout::~QgsLayout ( )

Definition at line 42 of file qgslayout.cpp.

Member Function Documentation

◆ addLayoutItem()

void QgsLayout::addLayoutItem ( QgsLayoutItem item)

Adds an item to the layout.

This should be called instead of the base class addItem() method. Ownership of the item is transferred to the layout.

Definition at line 401 of file qgslayout.cpp.

◆ addMultiFrame()

void QgsLayout::addMultiFrame ( QgsLayoutMultiFrame multiFrame)

Adds a multiFrame to the layout.

The object is owned by the layout until removeMultiFrame() is called.

See also
removeMultiFrame()
multiFrames()

Definition at line 433 of file qgslayout.cpp.

◆ context() [1/2]

QgsLayoutContext& QgsLayout::context ( )
inline

Returns a reference to the layout's context, which stores information relating to the current context and rendering settings for the layout.

Definition at line 301 of file qgslayout.h.

◆ context() [2/2]

const QgsLayoutContext& QgsLayout::context ( ) const
inline

Returns a reference to the layout's context, which stores information relating to the current context and rendering settings for the layout.

Definition at line 307 of file qgslayout.h.

◆ convertFromLayoutUnits() [1/3]

QgsLayoutMeasurement QgsLayout::convertFromLayoutUnits ( const double  length,
const QgsUnitTypes::LayoutUnit  unit 
) const

Converts a length measurement from the layout's native units to a specified target unit.

Returns
length of measurement in specified units
See also
convertToLayoutUnits()
units()

Definition at line 274 of file qgslayout.cpp.

◆ convertFromLayoutUnits() [2/3]

QgsLayoutSize QgsLayout::convertFromLayoutUnits ( const QSizeF &  size,
const QgsUnitTypes::LayoutUnit  unit 
) const

Converts a size from the layout's native units to a specified target unit.

Returns
size of measurement in specified units
See also
convertToLayoutUnits()
units()

Definition at line 279 of file qgslayout.cpp.

◆ convertFromLayoutUnits() [3/3]

QgsLayoutPoint QgsLayout::convertFromLayoutUnits ( const QPointF &  point,
const QgsUnitTypes::LayoutUnit  unit 
) const

Converts a point from the layout's native units to a specified target unit.

Returns
point in specified units
See also
convertToLayoutUnits()
units()

Definition at line 284 of file qgslayout.cpp.

◆ convertToLayoutUnits() [1/3]

double QgsLayout::convertToLayoutUnits ( const QgsLayoutMeasurement measurement) const

Converts a measurement into the layout's native units.

Returns
length of measurement in layout units
See also
convertFromLayoutUnits()
units()

Definition at line 259 of file qgslayout.cpp.

◆ convertToLayoutUnits() [2/3]

QSizeF QgsLayout::convertToLayoutUnits ( const QgsLayoutSize size) const

Converts a size into the layout's native units.

Returns
size of measurement in layout units
See also
convertFromLayoutUnits()
units()

Definition at line 264 of file qgslayout.cpp.

◆ convertToLayoutUnits() [3/3]

QPointF QgsLayout::convertToLayoutUnits ( const QgsLayoutPoint point) const

Converts a point into the layout's native units.

Returns
point in layout units
See also
convertFromLayoutUnits()
units()

Definition at line 269 of file qgslayout.cpp.

◆ createCommand()

QgsAbstractLayoutUndoCommand * QgsLayout::createCommand ( const QString &  text,
int  id = 0,
QUndoCommand *  parent = nullptr 
)
overridevirtual

Creates a new layout undo command with the specified text and parent.

The id argument can be used to specify an id number for the source event - this is used to determine whether QUndoCommand command compression can apply to the command.

Implements QgsLayoutUndoObjectInterface.

Definition at line 499 of file qgslayout.cpp.

◆ createExpressionContext()

QgsExpressionContext QgsLayout::createExpressionContext ( ) const
overridevirtual

Creates an expression context relating to the layout's current state.

The context includes scopes for global, project, layout and layout context properties.

Implements QgsExpressionContextGenerator.

Definition at line 299 of file qgslayout.cpp.

◆ customProperties()

QStringList QgsLayout::customProperties ( ) const

Return list of keys stored in custom properties for the layout.

See also
setCustomProperty()
customProperty()
removeCustomProperty()

Definition at line 332 of file qgslayout.cpp.

◆ customProperty()

QVariant QgsLayout::customProperty ( const QString &  key,
const QVariant &  defaultValue = QVariant() 
) const

Read a custom property from the layout.

Parameters
keyproperty key
defaultValuedefault value to return if property with matching key does not exist
Returns
value of matching property
See also
setCustomProperty()
removeCustomProperty()
customProperties()

Definition at line 322 of file qgslayout.cpp.

◆ deselectAll()

void QgsLayout::deselectAll ( )

Clears any selected items in the layout.

Call this method rather than QGraphicsScene::clearSelection, as the latter does not correctly emit signals to allow the layout's model to update.

Definition at line 126 of file qgslayout.cpp.

◆ exporter()

QgsLayoutExporter & QgsLayout::exporter ( )

Returns the layout's exporter, which is used for rendering the layout and exporting to various formats.

Definition at line 94 of file qgslayout.cpp.

◆ gridSettings() [1/2]

QgsLayoutGridSettings& QgsLayout::gridSettings ( )
inline

Returns a reference to the layout's grid settings, which stores settings relating to grid appearance, spacing and offsets.

Definition at line 325 of file qgslayout.h.

◆ gridSettings() [2/2]

const QgsLayoutGridSettings& QgsLayout::gridSettings ( ) const
inline

Returns a reference to the layout's grid settings, which stores settings relating to grid appearance, spacing and offsets.

Definition at line 331 of file qgslayout.h.

◆ groupItems()

QgsLayoutItemGroup * QgsLayout::groupItems ( const QList< QgsLayoutItem *> &  items)

Creates a new group from a list of layout items and adds the group to the layout.

If grouping was not possible, a nullptr will be returned.

See also
ungroupItems()

Definition at line 504 of file qgslayout.cpp.

◆ guides() [1/2]

QgsLayoutGuideCollection & QgsLayout::guides ( )

Returns a reference to the layout's guide collection, which manages page snap guides.

Definition at line 289 of file qgslayout.cpp.

◆ guides() [2/2]

const QgsLayoutGuideCollection & QgsLayout::guides ( ) const

Returns a reference to the layout's guide collection, which manages page snap guides.

Definition at line 294 of file qgslayout.cpp.

◆ initializeDefaults()

void QgsLayout::initializeDefaults ( )

Initializes an empty layout, e.g.

by adding a default page to the layout. This should be called after creating a new layout.

Definition at line 75 of file qgslayout.cpp.

◆ itemByUuid()

QgsLayoutItem * QgsLayout::itemByUuid ( const QString &  uuid)

Returns the layout item with matching uuid unique identifier, or a nullptr if a matching item could not be found.

See also
multiFrameByUuid()

Definition at line 195 of file qgslayout.cpp.

◆ itemsModel()

QgsLayoutModel * QgsLayout::itemsModel ( )

Returns the items model attached to the layout.

Definition at line 89 of file qgslayout.cpp.

◆ layoutBounds()

QRectF QgsLayout::layoutBounds ( bool  ignorePages = false,
double  margin = 0.0 
) const

Calculates the bounds of all non-gui items in the layout.

Ignores snap lines, mouse handles and other cosmetic items.

Parameters
ignorePagesset to true to ignore page items
marginoptional marginal (in percent, e.g., 0.05 = 5% ) to add around items
Returns
layout bounds, in layout units.

Definition at line 357 of file qgslayout.cpp.

◆ layoutItemAt() [1/2]

QgsLayoutItem * QgsLayout::layoutItemAt ( QPointF  position,
const bool  ignoreLocked = false 
) const

Returns the topmost layout item at a specified position.

Ignores paper items. If ignoreLocked is set to true any locked items will be ignored.

Definition at line 223 of file qgslayout.cpp.

◆ layoutItemAt() [2/2]

QgsLayoutItem * QgsLayout::layoutItemAt ( QPointF  position,
const QgsLayoutItem belowItem,
const bool  ignoreLocked = false 
) const

Returns the topmost composer item at a specified position which is below a specified item.

Ignores paper items. If ignoreLocked is set to true any locked items will be ignored.

Definition at line 228 of file qgslayout.cpp.

◆ layoutItems()

template<class T >
void QgsLayout::layoutItems ( QList< T *> &  itemList)
inline

Returns a list of layout items of a specific type.

Note
not available in Python bindings

Definition at line 110 of file qgslayout.h.

◆ lowerItem()

bool QgsLayout::lowerItem ( QgsLayoutItem item,
bool  deferUpdate = false 
)

Lowers an item down the z-order.

Returns true if the item was successfully lowered.

If deferUpdate is true, the scene will not be visibly updated to reflect the new stacking order. This allows multiple raiseItem() calls to be made in sequence without the cost of updating the scene for each one.

See also
raiseItem()
updateZValues()

Definition at line 156 of file qgslayout.cpp.

◆ moveItemToBottom()

bool QgsLayout::moveItemToBottom ( QgsLayoutItem item,
bool  deferUpdate = false 
)

Lowers an item down to the bottom of the z-order.

Returns true if the item was successfully lowered. If deferUpdate is true, the scene will not be visibly updated to reflect the new stacking order. This allows multiple raiseItem() calls to be made in sequence without the cost of updating the scene for each one.

See also
moveItemToTop()
updateZValues()

Definition at line 182 of file qgslayout.cpp.

◆ moveItemToTop()

bool QgsLayout::moveItemToTop ( QgsLayoutItem item,
bool  deferUpdate = false 
)

Raises an item up to the top of the z-order.

Returns true if the item was successfully raised.

If deferUpdate is true, the scene will not be visibly updated to reflect the new stacking order. This allows multiple raiseItem() calls to be made in sequence without the cost of updating the scene for each one.

See also
moveItemToBottom()
updateZValues()

Definition at line 169 of file qgslayout.cpp.

◆ multiFrameByUuid()

QgsLayoutMultiFrame * QgsLayout::multiFrameByUuid ( const QString &  uuid) const

Returns the layout multiframe with matching uuid unique identifier, or a nullptr if a matching multiframe could not be found.

See also
itemByUuid()

Definition at line 210 of file qgslayout.cpp.

◆ multiFrames()

QList< QgsLayoutMultiFrame * > QgsLayout::multiFrames ( ) const

Returns a list of multi frames contained in the layout.

See also
addMultiFrame()
removeMultiFrame()

Definition at line 447 of file qgslayout.cpp.

◆ name()

QString QgsLayout::name ( ) const
inline

Returns the layout's name.

See also
setName()

Definition at line 98 of file qgslayout.h.

◆ pageCollection() [1/2]

QgsLayoutPageCollection * QgsLayout::pageCollection ( )

Returns a pointer to the layout's page collection, which stores and manages page items in the layout.

Definition at line 347 of file qgslayout.cpp.

◆ pageCollection() [2/2]

const QgsLayoutPageCollection * QgsLayout::pageCollection ( ) const

Returns a pointer to the layout's page collection, which stores and manages page items in the layout.

Definition at line 352 of file qgslayout.cpp.

◆ project()

QgsProject * QgsLayout::project ( ) const

The project associated with the layout.

Used to get access to layers, map themes, relations and various other bits. It is never null.

Definition at line 84 of file qgslayout.cpp.

◆ raiseItem()

bool QgsLayout::raiseItem ( QgsLayoutItem item,
bool  deferUpdate = false 
)

Raises an item up the z-order.

Returns true if the item was successfully raised.

If deferUpdate is true, the scene will not be visibly updated to reflect the new stacking order. This allows multiple raiseItem() calls to be made in sequence without the cost of updating the scene for each one.

See also
lowerItem()
updateZValues()

Definition at line 143 of file qgslayout.cpp.

◆ readXml()

bool QgsLayout::readXml ( const QDomElement &  layoutElement,
const QDomDocument &  document,
const QgsReadWriteContext context 
)

Sets the collection's state from a DOM element.

layoutElement is the DOM node corresponding to the layout.

See also
writeXml()

Definition at line 657 of file qgslayout.cpp.

◆ referenceMap()

QgsLayoutItemMap * QgsLayout::referenceMap ( ) const

Returns the map item which will be used to generate corresponding world files when the layout is exported.

If no map was explicitly set via setReferenceMap(), the largest map in the layout will be returned (or nullptr if there are no maps in the layout).

See also
setReferenceMap()
generateWorldFile()

Definition at line 337 of file qgslayout.cpp.

◆ refresh

void QgsLayout::refresh ( )
slot

Forces the layout, and all items contained within it, to refresh.

For instance, this causes maps to redraw and rebuild cached images, html items to reload their source url, and attribute tables to refresh their contents. Calling this also triggers a recalculation of all data defined attributes within the layout.

See also
refreshed()

Definition at line 563 of file qgslayout.cpp.

◆ refreshed

void QgsLayout::refreshed ( )
signal

Is emitted when the layout has been refreshed and items should also be refreshed and updated.

◆ removeCustomProperty()

void QgsLayout::removeCustomProperty ( const QString &  key)

Remove a custom property from the layout.

Parameters
keyproperty key
See also
setCustomProperty()
customProperty()
customProperties()

Definition at line 327 of file qgslayout.cpp.

◆ removeLayoutItem()

void QgsLayout::removeLayoutItem ( QgsLayoutItem item)

Removes an item from the layout.

This should be called instead of the base class removeItem() method. The item will also be deleted.

Definition at line 417 of file qgslayout.cpp.

◆ removeMultiFrame()

void QgsLayout::removeMultiFrame ( QgsLayoutMultiFrame multiFrame)

Removes a multiFrame from the layout (but does not delete it).

See also
addMultiFrame()
multiFrames()

Definition at line 442 of file qgslayout.cpp.

◆ selectedItemChanged

void QgsLayout::selectedItemChanged ( QgsLayoutItem selected)
signal

Emitted whenever the selected item changes.

If nullptr, no item is selected.

◆ selectedLayoutItems()

QList< QgsLayoutItem * > QgsLayout::selectedLayoutItems ( const bool  includeLockedItems = true)

Returns list of selected layout items.

If includeLockedItems is set to true, then locked items will also be included in the returned list.

Definition at line 99 of file qgslayout.cpp.

◆ setCustomProperty()

void QgsLayout::setCustomProperty ( const QString &  key,
const QVariant &  value 
)

Set a custom property for the layout.

Parameters
keyproperty key. If a property with the same key already exists it will be overwritten.
valueproperty value
See also
customProperty()
removeCustomProperty()
customProperties()

Definition at line 314 of file qgslayout.cpp.

◆ setName()

void QgsLayout::setName ( const QString &  name)
inline

Sets the layout's name.

See also
name()

Definition at line 104 of file qgslayout.h.

◆ setReferenceMap()

void QgsLayout::setReferenceMap ( QgsLayoutItemMap map)

Sets the map item which will be used to generate corresponding world files when the layout is exported.

See also
referenceMap()
setGenerateWorldFile()

Definition at line 342 of file qgslayout.cpp.

◆ setSelectedItem()

void QgsLayout::setSelectedItem ( QgsLayoutItem item)

Clears any selected items and sets item as the current selection.

Definition at line 116 of file qgslayout.cpp.

◆ setUnits()

void QgsLayout::setUnits ( QgsUnitTypes::LayoutUnit  units)
inline

Sets the native measurement units for the layout.

These also form the default unit for measurements for the layout.

See also
units()
convertToLayoutUnits()

Definition at line 240 of file qgslayout.h.

◆ snapper() [1/2]

QgsLayoutSnapper& QgsLayout::snapper ( )
inline

Returns a reference to the layout's snapper, which stores handles layout snap grids and lines and snapping points to the nearest matching point.

Definition at line 313 of file qgslayout.h.

◆ snapper() [2/2]

const QgsLayoutSnapper& QgsLayout::snapper ( ) const
inline

Returns a reference to the layout's snapper, which stores handles layout snap grids and lines and snapping points to the nearest matching point.

Definition at line 319 of file qgslayout.h.

◆ undoStack() [1/2]

QgsLayoutUndoStack * QgsLayout::undoStack ( )

Returns a pointer to the layout's undo stack, which manages undo/redo states for the layout and it's associated objects.

Definition at line 452 of file qgslayout.cpp.

◆ undoStack() [2/2]

const QgsLayoutUndoStack * QgsLayout::undoStack ( ) const

Returns a pointer to the layout's undo stack, which manages undo/redo states for the layout and it's associated objects.

Definition at line 457 of file qgslayout.cpp.

◆ ungroupItems()

QList< QgsLayoutItem * > QgsLayout::ungroupItems ( QgsLayoutItemGroup group)

Ungroups items by removing them from an item group and removing the group from the layout.

Child items will remain in the layout and will not be deleted.

Returns a list of the items removed from the group, or an empty list if ungrouping was not successful.

See also
groupItems()

Definition at line 534 of file qgslayout.cpp.

◆ units()

QgsUnitTypes::LayoutUnit QgsLayout::units ( ) const
inline

Returns the native units for the layout.

See also
setUnits()
convertToLayoutUnits()

Definition at line 247 of file qgslayout.h.

◆ updateBounds

void QgsLayout::updateBounds ( )
slot

Updates the scene bounds of the layout.

Definition at line 678 of file qgslayout.cpp.

◆ updateZValues()

void QgsLayout::updateZValues ( const bool  addUndoCommands = true)

Resets the z-values of items based on their position in the internal z order list.

This should be called after any stacking changes which deferred z-order updates.

Definition at line 626 of file qgslayout.cpp.

◆ variablesChanged

void QgsLayout::variablesChanged ( )
signal

Emitted whenever the expression variables stored in the layout have been changed.

◆ writeXml()

QDomElement QgsLayout::writeXml ( QDomDocument &  document,
const QgsReadWriteContext context 
) const

Returns the layout's state encapsulated in a DOM element.

See also
readXml()

Definition at line 576 of file qgslayout.cpp.

Friends And Related Function Documentation

◆ QgsLayoutItemAddItemCommand

friend class QgsLayoutItemAddItemCommand
friend

Definition at line 579 of file qgslayout.h.

◆ QgsLayoutItemDeleteUndoCommand

friend class QgsLayoutItemDeleteUndoCommand
friend

Definition at line 580 of file qgslayout.h.

◆ QgsLayoutItemGroupUndoCommand

friend class QgsLayoutItemGroupUndoCommand
friend

Definition at line 583 of file qgslayout.h.

◆ QgsLayoutItemUndoCommand

friend class QgsLayoutItemUndoCommand
friend

Definition at line 581 of file qgslayout.h.

◆ QgsLayoutModel

friend class QgsLayoutModel
friend

Definition at line 584 of file qgslayout.h.

◆ QgsLayoutMultiFrame

friend class QgsLayoutMultiFrame
friend

Definition at line 585 of file qgslayout.h.

◆ QgsLayoutUndoCommand

friend class QgsLayoutUndoCommand
friend

Definition at line 582 of file qgslayout.h.


The documentation for this class was generated from the following files: