QGIS API Documentation  3.6.0-Noosa (5873452)
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,
  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. More...
 
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. More...
 

Public Member Functions

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

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.

Since
QGIS 3.0

Definition at line 286 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

PluginItem 

Starting point for plugin item types.

Definition at line 293 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 38 of file qgslayoutitemregistry.cpp.

◆ ~QgsLayoutItemRegistry()

QgsLayoutItemRegistry::~QgsLayoutItemRegistry ( )
override

Definition at line 43 of file qgslayoutitemregistry.cpp.

◆ QgsLayoutItemRegistry() [2/2]

QgsLayoutItemRegistry::QgsLayoutItemRegistry ( const QgsLayoutItemRegistry rh)
delete

QgsLayoutItemRegistry cannot be copied.

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 98 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 108 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 118 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 126 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 88 of file qgslayoutitemregistry.cpp.

◆ itemTypes()

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

Returns a map of available item types to translated name.

Definition at line 146 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 93 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

QgsLayoutItemRegistry cannot be copied.

◆ 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 49 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 134 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: