57   QList<QgsLayoutItemMap *> mapItems;
    63     if ( map->isSelected() )
    70   double largestZValue = std::numeric_limits< double >::lowest();
    73     if ( map->collidesWithItem( referenceItem ) && map->zValue() > largestZValue )
    76       largestZValue = map->zValue();
   115     return new QgsLayoutMapWidget( qobject_cast< QgsLayoutItemMap * >( item ), mapCanvas );
   116   }, createRubberBand );
   117   mapItemMetadata->setItemAddedToLayoutFunction( [ = ]( 
QgsLayoutItem * item )
   138   }, createRubberBand ) );
   147   }, createRubberBand );
   148   labelItemMetadata->setItemAddedToLayoutFunction( [ = ]( 
QgsLayoutItem * item )
   153     label->
setText( QObject::tr( 
"Lorem ipsum" ) );
   154     if ( QApplication::isRightToLeft() )
   159     QSizeF currentSize = label->rect().size();
   162     double labelWidth = std::max( minSize.width(), currentSize.width() );
   163     double labelHeight = std::max( minSize.height(), currentSize.height() );
   164     label->
attemptSetSceneRect( QRectF( label->pos().x(), label->pos().y(), labelWidth, labelHeight ) );
   176   }, createRubberBand );
   177   legendItemMetadata->setItemAddedToLayoutFunction( [ = ]( 
QgsLayoutItem * item )
   185     if ( QApplication::isRightToLeft() )
   197     const QString defaultFontString = settings.
value( QStringLiteral( 
"LayoutDesigner/defaultFont" ), QVariant(), 
QgsSettings::Gui ).toString();
   198     if ( !defaultFontString.isEmpty() )
   217   }, createRubberBand );
   218   scalebarItemMetadata->setItemAddedToLayoutFunction( [ = ]( 
QgsLayoutItem * item )
   221     Q_ASSERT( scalebar );
   235   std::unique_ptr< QgsLayoutItemGuiMetadata > northArrowMetadata = qgis::make_unique< QgsLayoutItemGuiMetadata>(
   240   }, createRubberBand );
   245     QList< QgsLayoutItemPicture * > pictureItems;
   247     int northArrowCount = 0;
   250     const QString defaultPath = settings.
value( QStringLiteral( 
"LayoutDesigner/defaultNorthArrow" ), QStringLiteral( 
":/images/north_arrows/layout_default_north_arrow.svg" ), 
QgsSettings::Gui ).toString();
   255       if ( p->picturePath() == defaultPath )
   259     std::unique_ptr< QgsLayoutItemPicture > picture = qgis::make_unique< QgsLayoutItemPicture >( layout );
   261     picture->setPicturePath( defaultPath );
   263     picture->setId( northArrowCount > 0 ? QObject::tr( 
"North Arrow %1" ).arg( northArrowCount + 1 ) : QObject::tr( 
"North Arrow" ) );
   264     return picture.release();
   266   northArrowMetadata->setItemAddedToLayoutFunction( [ = ]( 
QgsLayoutItem * item )
   271     QList<QgsLayoutItemMap *> mapItems;
   281   auto createShapeWidget =
   289     std::unique_ptr< QgsLayoutItemShape > shape = qgis::make_unique< QgsLayoutItemShape >( layout );
   291     return shape.release();
   295     std::unique_ptr< QgsLayoutItemShape > shape = qgis::make_unique< QgsLayoutItemShape >( layout );
   297     return shape.release();
   301     std::unique_ptr< QgsLayoutItemShape > shape = qgis::make_unique< QgsLayoutItemShape >( layout );
   303     return shape.release();
   307   std::unique_ptr< QgsLayoutItemGuiMetadata > arrowMetadata = qgis::make_unique< QgsLayoutItemGuiMetadata>(
   312   }, createRubberBand, QString(), true );
   315     std::unique_ptr< QgsLayoutItemPolyline > arrow = qgis::make_unique< QgsLayoutItemPolyline >( layout );
   317     return arrow.release();
   319   arrowMetadata->setNodeRubberBandCreationFunction( []( 
QgsLayoutView * )->QGraphicsPathItem*
   321     std::unique_ptr< QGraphicsPathItem > band = qgis::make_unique< QGraphicsPathItem >();
   322     band->setPen( QPen( QBrush( QColor( 227, 22, 22, 200 ) ), 0 ) );
   324     return band.release();
   330   std::unique_ptr< QgsLayoutItemGuiMetadata > polygonMetadata = qgis::make_unique< QgsLayoutItemGuiMetadata >(
   335   }, createRubberBand, QStringLiteral( 
"nodes" ), true );
   336   polygonMetadata->setNodeRubberBandCreationFunction( []( 
QgsLayoutView * )->QGraphicsPolygonItem*
   338     std::unique_ptr< QGraphicsPolygonItem > band = qgis::make_unique< QGraphicsPolygonItem >();
   339     band->setBrush( Qt::NoBrush );
   340     band->setPen( QPen( QBrush( QColor( 227, 22, 22, 200 ) ), 0 ) );
   342     return band.release();
   346   std::unique_ptr< QgsLayoutItemGuiMetadata > polylineMetadata = qgis::make_unique< QgsLayoutItemGuiMetadata>(
   351   }, createRubberBand, QStringLiteral( 
"nodes" ), true );
   352   polylineMetadata->setNodeRubberBandCreationFunction( []( 
QgsLayoutView * )->QGraphicsPathItem*
   354     std::unique_ptr< QGraphicsPathItem > band = qgis::make_unique< QGraphicsPathItem >();
   355     band->setPen( QPen( QBrush( QColor( 227, 22, 22, 200 ) ), 0 ) );
   357     return band.release();
   368   }, createRubberBand );
   371     std::unique_ptr< QgsLayoutItemHtml > htmlMultiFrame = qgis::make_unique< QgsLayoutItemHtml >( layout );
   374     std::unique_ptr< QgsLayoutFrame > frame = qgis::make_unique< QgsLayoutFrame >( layout, html );
   376     html->addFrame( frame.release() );
   387   }, createRubberBand );
   390     std::unique_ptr< QgsLayoutItemAttributeTable > tableMultiFrame = qgis::make_unique< QgsLayoutItemAttributeTable >( layout );
   395     for ( 
auto it = layerMap.constBegin() ; it != layerMap.constEnd(); ++it )
   397       if ( 
QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( it.value() ) )
   399         table->setVectorLayer( vl );
   405     std::unique_ptr< QgsLayoutFrame > frame = qgis::make_unique< QgsLayoutFrame >( layout, table );
   407     table->addFrame( frame.release() );
   418   }, createRubberBand );
   421     std::unique_ptr< QgsLayoutItemManualTable > tableMultiFrame = qgis::make_unique< QgsLayoutItemManualTable >( layout );
   432     std::unique_ptr< QgsLayoutFrame > frame = qgis::make_unique< QgsLayoutFrame >( layout, table );
   434     table->addFrame( frame.release() );
 QgsUnitTypes::DistanceUnit guessUnits() const
Attempts to guess the most reasonable unit choice for the scalebar, given the current linked map's sc...
 
Stores GUI metadata about a group of layout item classes. 
 
QgsLayoutItemMap * findSensibleDefaultLinkedMapItem(QgsLayoutItem *referenceItem)
Attempts to find the best guess at a map item to link referenceItem to, by: 
 
Base class for graphical items within a QgsLayout. 
 
A graphical widget to display and interact with QgsLayouts. 
 
QgsLayoutViewEllipseRubberBand is elliptical rubber band for use within QgsLayoutView widgets...
 
This class is a composition of two QSettings instances: 
 
void setTableContents(const QgsTableContents &contents)
Sets the contents of the table. 
 
A layout item subclass for text labels. 
 
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key. 
 
Encapsulates the contents and formatting of a single table cell. 
 
void setLinkedMap(QgsLayoutItemMap *map)
Sets the map item linked to the scalebar. 
 
QgsLayoutViewTriangleRubberBand is triangular rubber band for use within QgsLayoutView widgets...
 
A layout item subclass that displays SVG files or raster format images (jpg, png, ...
 
void setAlignment(Qt::Alignment alignment)
Sets the alignment for the legend component. 
 
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon. 
 
Z-value for temporary view tool items. 
 
Registry of available layout item GUI behavior. 
 
QgsRectangle visibleExtent() const
Returns the actual extent derived from requested extent that takes takes output image size into accou...
 
Map canvas is a class for displaying all GIS data types on a canvas. 
 
void layoutItems(QList< T *> &itemList) const
Returns a list of layout items of a specific type. 
 
Layout graphical items for displaying a map. 
 
const QgsLayout * layout() const
Returns the layout the object is attached to. 
 
static QgsLayoutItemGuiRegistry * layoutItemGuiRegistry()
Returns the global layout item GUI registry, used for registering the GUI behavior of layout items...
 
void setHAlign(Qt::AlignmentFlag alignment)
Sets the horizontal alignment of the label. 
 
static void registerGuiForKnownItemTypes(QgsMapCanvas *mapCanvas)
Registers the GUI handlers for known layout item types. 
 
void attemptSetSceneRect(const QRectF &rect, bool includesFrame=false)
Attempts to update the item's position and size to match the passed rect in layout coordinates...
 
QgsLegendStyle & rstyle(QgsLegendStyle::Style s)
Returns reference to modifiable legend style. 
 
void setLinkedMap(QgsLayoutItemMap *map)
Sets the map object for rotation. 
 
A layout table subclass that displays attributes from a vector layer. 
 
Base class for layouts, which can contain items such as maps, labels, scalebars, etc. 
 
QMap< QString, QgsMapLayer * > mapLayers(const bool validOnly=false) const
Returns a map of all registered layers by layer ID. 
 
void updateLegend()
Updates the model and all legend entries. 
 
bool addItemGroup(const QgsLayoutItemGuiGroup &group)
Registers a new item group with the registry. 
 
QSizeF sizeForText() const
Returns the required item size (in layout units) for the label's text to fill the item...
 
QgsLayoutViewRectangularRubberBand is rectangular rubber band for use within QgsLayoutView widgets...
 
const QgsMapSettings & mapSettings() const
Gets access to properties used for map rendering. 
 
QVector< QgsTableRow > QgsTableContents
A set of table rows. 
 
QgsLayoutItemMap * referenceMap() const
Returns the map item which will be used to generate corresponding world files when the layout is expo...
 
void setLinkedMap(QgsLayoutItemMap *map)
Sets the map to associate with the legend. 
 
QgsLayoutViewRubberBand is an abstract base class for temporary rubber band items in various shapes...
 
static QgsProject * instance()
Returns the QgsProject singleton instance. 
 
QgsProject * project() const
The project associated with the layout. 
 
QFont & rfont()
Returns a modifiable reference to the component's font. 
 
A layout item subclass for scale bars. 
 
bool addLayoutItemGuiMetadata(QgsLayoutItemAbstractGuiMetadata *metadata)
Registers the gui metadata for a new layout item type. 
 
A layout table subclass that displays manually entered (and formatted) content. 
 
void zoomToExtent(const QgsRectangle &extent)
Zooms the map so that the specified extent is fully visible within the map item. 
 
A layout item subclass for map legends. 
 
Symbol label (excluding icon) 
 
Represents a vector layer which manages a vector based data sets. 
 
Base class for frame items, which form a layout multiframe item. 
 
A layout multiframe subclass for HTML content. 
 
void setTitleAlignment(Qt::AlignmentFlag alignment)
Sets the alignment of the legend title. 
 
void addMultiFrame(QgsLayoutMultiFrame *multiFrame)
Adds a multiFrame to the layout. 
 
void setSymbolAlignment(Qt::AlignmentFlag alignment)
Sets the alignment for placement of legend symbols. 
 
void setText(const QString &text)
Sets the label's preset text. 
 
void applyDefaultSize(QgsUnitTypes::DistanceUnit units=QgsUnitTypes::DistanceMeters)
Applies the default size to the scale bar (scale bar 1/5 of map item width) 
 
QVector< QgsTableCell > QgsTableRow
A row of table cells. 
 
void setBackgroundColor(const QColor &color)
Sets the background color for this item.