QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
QgsLayoutItemGuiRegistry Class Reference

Registry of available layout item GUI behavior. More...

#include <qgslayoutitemguiregistry.h>

Inheritance diagram for QgsLayoutItemGuiRegistry:

Signals

void groupRemoved (QString groupId)
 Emitted whenever an item group is removed from the registry.
void typeAdded (int metadataId)
 Emitted whenever a new item type is added to the registry, with the specified metadataId.
void typeRemoved (int metadataId)
 Emitted whenever an item type is removed from the registry, with the specified metadataId.

Public Member Functions

 QgsLayoutItemGuiRegistry (const QgsLayoutItemGuiRegistry &rh)=delete
 QgsLayoutItemGuiRegistry (QObject *parent=nullptr)
 Creates a new empty item GUI registry.
 ~QgsLayoutItemGuiRegistry () override
bool addItemGroup (const QgsLayoutItemGuiGroup &group)
 Registers a new item group with the registry.
bool addLayoutItemGuiMetadata (QgsLayoutItemAbstractGuiMetadata *metadata)
 Registers the GUI metadata for a new layout item type.
QgsLayoutItemcreateItem (int metadataId, QgsLayout *layout) const
 Creates a new instance of a layout item given the item metadata metadataId, target layout.
QgsLayoutViewRubberBandcreateItemRubberBand (int metadataId, QgsLayoutView *view) const
 Creates a new rubber band item for the specified item metadataId and destination view.
QgsLayoutItemBaseWidgetcreateItemWidget (QgsLayoutItem *item) const
 Creates a new instance of a layout item configuration widget for the specified item.
QGraphicsItem * createNodeItemRubberBand (int metadataId, QgsLayoutView *view)
 Creates a rubber band for the specified item metadataId and destination view.
const QgsLayoutItemGuiGroupitemGroup (const QString &id)
 Returns a reference to the item group with matching id.
QgsLayoutItemAbstractGuiMetadataitemMetadata (int metadataId) const
 Returns the metadata for the specified item metadataId.
QList< int > itemMetadataIds () const
 Returns a list of available item metadata ids handled by the registry.
int metadataIdForItemType (int type) const
 Returns the GUI item metadata ID which corresponds to the specified layout item type.
void newItemAddedToLayout (int metadataId, QgsLayoutItem *item, const QVariantMap &properties=QVariantMap())
 Called when a newly created item of the associated metadata metadataId has been added to a layout.
QgsLayoutItemGuiRegistryoperator= (const QgsLayoutItemGuiRegistry &rh)=delete
bool removeItemGroup (const QString &id)
 Unregisters an item group from the registry.
bool removeLayoutItemGuiMetadata (int type)
 Unregisters the GUI metadata for a layout item type.
bool removeLayoutItemGuiMetadata (QgsLayoutItemAbstractGuiMetadata *metadata)
 Unregisters the GUI metadata for a layout item type.

Detailed Description

Registry of available layout item GUI behavior.

QgsLayoutItemGuiRegistry is not usually directly created, but rather accessed through QgsGui::layoutItemGuiRegistry().

This acts as a companion to QgsLayoutItemRegistry, handling only the components related to the GUI behavior of layout items.

Definition at line 376 of file qgslayoutitemguiregistry.h.

Constructor & Destructor Documentation

◆ QgsLayoutItemGuiRegistry() [1/2]

QgsLayoutItemGuiRegistry::QgsLayoutItemGuiRegistry ( QObject * parent = nullptr)

Creates a new empty item GUI registry.

QgsLayoutItemGuiRegistry is not usually directly created, but rather accessed through QgsGui::layoutItemGuiRegistry().

Definition at line 58 of file qgslayoutitemguiregistry.cpp.

◆ ~QgsLayoutItemGuiRegistry()

QgsLayoutItemGuiRegistry::~QgsLayoutItemGuiRegistry ( )
override

Definition at line 63 of file qgslayoutitemguiregistry.cpp.

◆ QgsLayoutItemGuiRegistry() [2/2]

QgsLayoutItemGuiRegistry::QgsLayoutItemGuiRegistry ( const QgsLayoutItemGuiRegistry & rh)
delete

Member Function Documentation

◆ addItemGroup()

bool QgsLayoutItemGuiRegistry::addItemGroup ( const QgsLayoutItemGuiGroup & group)

Registers a new item group with the registry.

This must be done before calling addLayoutItemGuiMetadata() for any item types associated with the group.

Returns true if group was added, or false if group could not be added (e.g. due to duplicate id value).

See also
itemGroup()

Definition at line 112 of file qgslayoutitemguiregistry.cpp.

◆ addLayoutItemGuiMetadata()

bool QgsLayoutItemGuiRegistry::addLayoutItemGuiMetadata ( QgsLayoutItemAbstractGuiMetadata * metadata)

Registers the GUI metadata for a new layout item type.

Takes ownership of the metadata instance.

Definition at line 83 of file qgslayoutitemguiregistry.cpp.

◆ createItem()

QgsLayoutItem * QgsLayoutItemGuiRegistry::createItem ( int metadataId,
QgsLayout * layout ) const

Creates a new instance of a layout item given the item metadata metadataId, target layout.

Definition at line 137 of file qgslayoutitemguiregistry.cpp.

◆ createItemRubberBand()

QgsLayoutViewRubberBand * QgsLayoutItemGuiRegistry::createItemRubberBand ( int metadataId,
QgsLayoutView * view ) const

Creates a new rubber band item for the specified item metadataId and destination view.

Note
not available from Python bindings
See also
createNodeItemRubberBand()

Definition at line 188 of file qgslayoutitemguiregistry.cpp.

◆ createItemWidget()

QgsLayoutItemBaseWidget * QgsLayoutItemGuiRegistry::createItemWidget ( QgsLayoutItem * item) const

Creates a new instance of a layout item configuration widget for the specified item.

Definition at line 167 of file qgslayoutitemguiregistry.cpp.

◆ createNodeItemRubberBand()

QGraphicsItem * QgsLayoutItemGuiRegistry::createNodeItemRubberBand ( int metadataId,
QgsLayoutView * view )

Creates a rubber band for the specified item metadataId and destination view.

Can return nullptr if no node based rubber band should be created or is applicable for the item.

See also
createItemRubberBand()
Note
not available from Python bindings

Definition at line 197 of file qgslayoutitemguiregistry.cpp.

◆ groupRemoved

void QgsLayoutItemGuiRegistry::groupRemoved ( QString groupId)
signal

Emitted whenever an item group is removed from the registry.

Since
QGIS 4.0

◆ itemGroup()

const QgsLayoutItemGuiGroup & QgsLayoutItemGuiRegistry::itemGroup ( const QString & id)

Returns a reference to the item group with matching id.

See also
addItemGroup()

Definition at line 121 of file qgslayoutitemguiregistry.cpp.

◆ itemMetadata()

QgsLayoutItemAbstractGuiMetadata * QgsLayoutItemGuiRegistry::itemMetadata ( int metadataId) const

Returns the metadata for the specified item metadataId.

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

Definition at line 68 of file qgslayoutitemguiregistry.cpp.

◆ itemMetadataIds()

QList< int > QgsLayoutItemGuiRegistry::itemMetadataIds ( ) const

Returns a list of available item metadata ids handled by the registry.

Definition at line 206 of file qgslayoutitemguiregistry.cpp.

◆ metadataIdForItemType()

int QgsLayoutItemGuiRegistry::metadataIdForItemType ( int type) const

Returns the GUI item metadata ID which corresponds to the specified layout item type.

In the case that multiple GUI metadata classes exist for a single layout item type then only the first encountered GUI metadata ID will be returned.

Returns -1 if no matching metadata is found in the GUI registry.

Since
QGIS 3.18

Definition at line 73 of file qgslayoutitemguiregistry.cpp.

◆ newItemAddedToLayout()

void QgsLayoutItemGuiRegistry::newItemAddedToLayout ( int metadataId,
QgsLayoutItem * item,
const QVariantMap & properties = QVariantMap() )

Called when a newly created item of the associated metadata metadataId has been added to a layout.

This is only called for additions which result from GUI operations - i.e. it is not called for items added from templates.

Since QGIS 3.18 the optional properties argument can be used to pass custom properties to the QgsLayoutItemGuiMetadata::newItemAddedToLayout() function.

Definition at line 151 of file qgslayoutitemguiregistry.cpp.

◆ operator=()

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

◆ removeItemGroup()

bool QgsLayoutItemGuiRegistry::removeItemGroup ( const QString & id)

Unregisters an item group from the registry.

This must be done after calling removeLayoutItemGuiMetadata() for every item types associated with the group.

Since
QGIS 4.0

Definition at line 126 of file qgslayoutitemguiregistry.cpp.

◆ removeLayoutItemGuiMetadata() [1/2]

bool QgsLayoutItemGuiRegistry::removeLayoutItemGuiMetadata ( int type)

Unregisters the GUI metadata for a layout item type.

Since
QGIS 4.0

Definition at line 94 of file qgslayoutitemguiregistry.cpp.

◆ removeLayoutItemGuiMetadata() [2/2]

bool QgsLayoutItemGuiRegistry::removeLayoutItemGuiMetadata ( QgsLayoutItemAbstractGuiMetadata * metadata)

Unregisters the GUI metadata for a layout item type.

The metadata object will be deleted and should not be used after this call.

Since
QGIS 4.0

Definition at line 105 of file qgslayoutitemguiregistry.cpp.

◆ typeAdded

void QgsLayoutItemGuiRegistry::typeAdded ( int metadataId)
signal

Emitted whenever a new item type is added to the registry, with the specified metadataId.

◆ typeRemoved

void QgsLayoutItemGuiRegistry::typeRemoved ( int metadataId)
signal

Emitted whenever an item type is removed from the registry, with the specified metadataId.

Since
QGIS 4.0

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