QGIS API Documentation 3.41.0-Master (cea29feecf2)
|
Registry of available layout item types. More...
#include <qgslayoutitemregistry.h>
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. | |
QgsLayoutItem * | createItem (int type, QgsLayout *layout) const |
Creates a new instance of a layout item given the item type, and target layout. | |
QgsLayoutMultiFrame * | createMultiFrame (int type, QgsLayout *layout) const |
Creates a new instance of a layout multiframe given the multiframe type, and target layout. | |
QgsLayoutItemAbstractMetadata * | itemMetadata (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. | |
QgsLayoutMultiFrameAbstractMetadata * | multiFrameMetadata (int type) const |
Returns the metadata for the specified multiframe type. | |
QgsLayoutItemRegistry & | operator= (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. | |
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.
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.
|
PluginItem | Starting point for plugin item types. |
Definition at line 331 of file qgslayoutitemregistry.h.
QgsLayoutItemRegistry::QgsLayoutItemRegistry | ( | QObject * | parent = nullptr | ) |
Creates a new empty item registry.
QgsLayoutItemRegistry is not usually directly created, but rather accessed through QgsApplication::layoutItemRegistry().
Definition at line 39 of file qgslayoutitemregistry.cpp.
|
override |
Definition at line 44 of file qgslayoutitemregistry.cpp.
|
delete |
bool QgsLayoutItemRegistry::addLayoutItemType | ( | QgsLayoutItemAbstractMetadata * | metadata | ) |
Registers a new layout item type.
Takes ownership of the metadata instance.
Definition at line 103 of file qgslayoutitemregistry.cpp.
bool QgsLayoutItemRegistry::addLayoutMultiFrameType | ( | QgsLayoutMultiFrameAbstractMetadata * | metadata | ) |
Registers a new layout multiframe type.
Takes ownership of the metadata instance.
Definition at line 113 of file qgslayoutitemregistry.cpp.
QgsLayoutItem * QgsLayoutItemRegistry::createItem | ( | int | type, |
QgsLayout * | layout | ||
) | const |
Creates a new instance of a layout item given the item type, and target layout.
Definition at line 123 of file qgslayoutitemregistry.cpp.
QgsLayoutMultiFrame * QgsLayoutItemRegistry::createMultiFrame | ( | int | type, |
QgsLayout * | layout | ||
) | const |
Creates a new instance of a layout multiframe given the multiframe type, and target layout.
Definition at line 131 of file qgslayoutitemregistry.cpp.
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.
Definition at line 93 of file qgslayoutitemregistry.cpp.
QMap< int, QString > QgsLayoutItemRegistry::itemTypes | ( | ) | const |
Returns a map of available item types to translated name.
Definition at line 151 of file qgslayoutitemregistry.cpp.
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.
Definition at line 98 of file qgslayoutitemregistry.cpp.
|
signal |
Emitted whenever a new multiframe type is added to the registry, with the specified type and visible name.
|
delete |
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.
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.
|
signal |
Emitted whenever a new item type is added to the registry, with the specified type and visible name.