QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
Public Types | Signals | Public Member Functions | List of all members
QgsLayoutItemRegistry Class Reference

Registry of available layout item types. More...

#include <qgslayoutitemregistry.h>

Inheritance diagram for QgsLayoutItemRegistry:
Inheritance graph
[legend]

Public Types

enum  ItemType {
  LayoutItem = QGraphicsItem::UserType + 100 , LayoutGroup , LayoutPage , LayoutMap ,
  LayoutPicture , LayoutLabel , LayoutLegend , LayoutShape ,
  LayoutPolygon , LayoutPolyline , LayoutScaleBar , LayoutFrame ,
  LayoutHtml , LayoutAttributeTable , LayoutTextTable , Layout3DMap ,
  LayoutManualTable , LayoutMarker , LayoutElevationProfile , PluginItem = LayoutTextTable + 10000
}
 Item types. More...
 

Signals

void multiFrameTypeAdded (int type, const QString &name)
 Emitted whenever a new multiframe type is added to the registry, with the specified type and visible name.
 
void typeAdded (int type, const QString &name)
 Emitted whenever a new item type is added to the registry, with the specified type and visible name.
 

Public Member Functions

 QgsLayoutItemRegistry (const QgsLayoutItemRegistry &rh)=delete
 
 QgsLayoutItemRegistry (QObject *parent=nullptr)
 Creates a new empty item registry.
 
 ~QgsLayoutItemRegistry () override
 
bool addLayoutItemType (QgsLayoutItemAbstractMetadata *metadata)
 Registers a new layout item type.
 
bool addLayoutMultiFrameType (QgsLayoutMultiFrameAbstractMetadata *metadata)
 Registers a new layout multiframe type.
 
QgsLayoutItemcreateItem (int type, QgsLayout *layout) const
 Creates a new instance of a layout item given the item type, and target layout.
 
QgsLayoutMultiFramecreateMultiFrame (int type, QgsLayout *layout) const
 Creates a new instance of a layout multiframe given the multiframe type, and target layout.
 
QgsLayoutItemAbstractMetadataitemMetadata (int type) const
 Returns the metadata for the specified item type.
 
QMap< int, QString > itemTypes () const
 Returns a map of available item types to translated name.
 
QgsLayoutMultiFrameAbstractMetadatamultiFrameMetadata (int type) const
 Returns the metadata for the specified multiframe type.
 
QgsLayoutItemRegistryoperator= (const QgsLayoutItemRegistry &rh)=delete
 
bool populate ()
 Populates the registry with standard item types.
 
void resolvePaths (int type, QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving) const
 Resolve paths in properties of a particular symbol layer.
 

Detailed Description

Registry of available layout item types.

QgsLayoutItemRegistry is not usually directly created, but rather accessed through QgsApplication::layoutItemRegistry().

A companion class, QgsLayoutItemGuiRegistry, handles the GUI behavior of layout items.

Definition at line 324 of file qgslayoutitemregistry.h.

Member Enumeration Documentation

◆ ItemType

Item types.

Enumerator
LayoutItem 

Base class for items.

LayoutGroup 

Grouped item.

LayoutPage 

Page items.

LayoutMap 

Map item.

LayoutPicture 

Picture item.

LayoutLabel 

Label item.

LayoutLegend 

Legend item.

LayoutShape 

Shape item.

LayoutPolygon 

Polygon shape item.

LayoutPolyline 

Polyline shape item.

LayoutScaleBar 

Scale bar item.

LayoutFrame 

Frame item, part of a QgsLayoutMultiFrame object.

LayoutHtml 

Html multiframe item.

LayoutAttributeTable 

Attribute table.

LayoutTextTable 

Preset text table.

Layout3DMap 

3D map item

LayoutManualTable 

Manual (fixed) table.

LayoutMarker 

Marker item.

LayoutElevationProfile 

Elevation profile item.

Since
QGIS 3.30
PluginItem 

Starting point for plugin item types.

Definition at line 331 of file qgslayoutitemregistry.h.

Constructor & Destructor Documentation

◆ QgsLayoutItemRegistry() [1/2]

QgsLayoutItemRegistry::QgsLayoutItemRegistry ( QObject *  parent = nullptr)

Creates a new empty item registry.

QgsLayoutItemRegistry is not usually directly created, but rather accessed through QgsApplication::layoutItemRegistry().

See also
populate()

Definition at line 39 of file qgslayoutitemregistry.cpp.

◆ ~QgsLayoutItemRegistry()

QgsLayoutItemRegistry::~QgsLayoutItemRegistry ( )
override

Definition at line 44 of file qgslayoutitemregistry.cpp.

◆ QgsLayoutItemRegistry() [2/2]

QgsLayoutItemRegistry::QgsLayoutItemRegistry ( const QgsLayoutItemRegistry rh)
delete

Member Function Documentation

◆ addLayoutItemType()

bool QgsLayoutItemRegistry::addLayoutItemType ( QgsLayoutItemAbstractMetadata metadata)

Registers a new layout item type.

Takes ownership of the metadata instance.

See also
addLayoutMultiFrameType()

Definition at line 103 of file qgslayoutitemregistry.cpp.

◆ addLayoutMultiFrameType()

bool QgsLayoutItemRegistry::addLayoutMultiFrameType ( QgsLayoutMultiFrameAbstractMetadata metadata)

Registers a new layout multiframe type.

Takes ownership of the metadata instance.

See also
addLayoutItemType()

Definition at line 113 of file qgslayoutitemregistry.cpp.

◆ createItem()

QgsLayoutItem * QgsLayoutItemRegistry::createItem ( int  type,
QgsLayout layout 
) const

Creates a new instance of a layout item given the item type, and target layout.

See also
createMultiFrame()

Definition at line 123 of file qgslayoutitemregistry.cpp.

◆ createMultiFrame()

QgsLayoutMultiFrame * QgsLayoutItemRegistry::createMultiFrame ( int  type,
QgsLayout layout 
) const

Creates a new instance of a layout multiframe given the multiframe type, and target layout.

See also
createItem()

Definition at line 131 of file qgslayoutitemregistry.cpp.

◆ itemMetadata()

QgsLayoutItemAbstractMetadata * QgsLayoutItemRegistry::itemMetadata ( int  type) const

Returns the metadata for the specified item type.

Returns nullptr if a corresponding type was not found in the registry.

See also
multiFrameMetadata()

Definition at line 93 of file qgslayoutitemregistry.cpp.

◆ itemTypes()

QMap< int, QString > QgsLayoutItemRegistry::itemTypes ( ) const

Returns a map of available item types to translated name.

Definition at line 151 of file qgslayoutitemregistry.cpp.

◆ multiFrameMetadata()

QgsLayoutMultiFrameAbstractMetadata * QgsLayoutItemRegistry::multiFrameMetadata ( int  type) const

Returns the metadata for the specified multiframe type.

Returns nullptr if a corresponding type was not found in the registry.

See also
itemMetadata()

Definition at line 98 of file qgslayoutitemregistry.cpp.

◆ multiFrameTypeAdded

void QgsLayoutItemRegistry::multiFrameTypeAdded ( int  type,
const QString &  name 
)
signal

Emitted whenever a new multiframe type is added to the registry, with the specified type and visible name.

◆ operator=()

QgsLayoutItemRegistry & QgsLayoutItemRegistry::operator= ( const QgsLayoutItemRegistry rh)
delete

◆ populate()

bool QgsLayoutItemRegistry::populate ( )

Populates the registry with standard item types.

If called on a non-empty registry then this will have no effect and will return false.

Definition at line 50 of file qgslayoutitemregistry.cpp.

◆ resolvePaths()

void QgsLayoutItemRegistry::resolvePaths ( int  type,
QVariantMap &  properties,
const QgsPathResolver pathResolver,
bool  saving 
) const

Resolve paths in properties of a particular symbol layer.

This normally means converting relative paths to absolute paths when loading and converting absolute paths to relative paths when saving.

Definition at line 139 of file qgslayoutitemregistry.cpp.

◆ typeAdded

void QgsLayoutItemRegistry::typeAdded ( int  type,
const QString &  name 
)
signal

Emitted whenever a new item type is added to the registry, with the specified type and visible name.


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