QGIS API Documentation  3.18.1-Zürich (202f1bf7e5)
Public Member Functions | Protected Attributes | List of all members
QgsLayoutItemGuiMetadata Class Reference

Convenience metadata class that uses static functions to handle layout item GUI behavior. More...

#include <qgslayoutitemguiregistry.h>

Inheritance diagram for QgsLayoutItemGuiMetadata:
Inheritance graph
[legend]

Public Member Functions

 QgsLayoutItemGuiMetadata (int type, const QString &visibleName, const QIcon &creationIcon, const QgsLayoutItemWidgetFunc &pfWidget=nullptr, const QgsLayoutItemRubberBandFunc &pfRubberBand=nullptr, const QString &groupId=QString(), bool isNodeBased=false, QgsLayoutItemAbstractGuiMetadata::Flags flags=QgsLayoutItemAbstractGuiMetadata::Flags(), const QgsLayoutItemCreateFunc &pfCreateFunc=nullptr)
 Constructor for QgsLayoutItemGuiMetadata with the specified class type and creationIcon, and function pointers for the various configuration widget creation functions. More...
 
QgsLayoutItemcreateItem (QgsLayout *layout) override
 Creates an instance of the corresponding item type. More...
 
QgsLayoutItemBaseWidgetcreateItemWidget (QgsLayoutItem *item) override
 Creates a configuration widget for an item of this type. More...
 
QAbstractGraphicsShapeItem * createNodeRubberBand (QgsLayoutView *view) override
 Creates a rubber band for use when creating layout node based items of this type. More...
 
QgsLayoutViewRubberBandcreateRubberBand (QgsLayoutView *view) override
 Creates a rubber band for use when creating layout items of this type. More...
 
QIcon creationIcon () const override
 Returns an icon representing creation of the layout item type. More...
 
QgsLayoutItemAddedToLayoutFunc itemAddToLayoutFunction () const
 Returns the classes' item added to layout function. More...
 
QgsLayoutItemCreateFunc itemCreationFunction () const
 Returns the classes' item creation function. More...
 
void newItemAddedToLayout (QgsLayoutItem *item) override
 Called when a newly created item of the associated type has been added to a layout. More...
 
void newItemAddedToLayout (QgsLayoutItem *item, const QVariantMap &properties)
 Called when a newly created item of the associated type has been added to a layout. More...
 
QgsLayoutNodeItemRubberBandFunc nodeRubberBandCreationFunction () const
 Returns the classes' node based rubber band creation function. More...
 
QgsLayoutItemRubberBandFunc rubberBandCreationFunction () const
 Returns the classes' rubber band creation function. More...
 
void setItemAddedToLayoutFunction (const QgsLayoutItemAddedToLayoutFunc &function)
 Sets the classes' item creation function. More...
 
void setItemCreationFunction (const QgsLayoutItemCreateFunc &function)
 Sets the classes' item creation function. More...
 
void setNodeRubberBandCreationFunction (const QgsLayoutNodeItemRubberBandFunc &function)
 Sets the classes' node based rubber band creation function. More...
 
void setRubberBandCreationFunction (const QgsLayoutItemRubberBandFunc &function)
 Sets the classes' rubber band creation function. More...
 
void setWidgetFunction (const QgsLayoutItemWidgetFunc &function)
 Sets the classes' configuration widget creation function. More...
 
QgsLayoutItemWidgetFunc widgetFunction () const
 Returns the classes' configuration widget creation function. More...
 

Protected Attributes

QgsLayoutItemAddedToLayoutFunc mAddedToLayoutFunc = nullptr
 
QgsLayoutItemCreateFunc mCreateFunc = nullptr
 
QIcon mIcon
 
QgsLayoutNodeItemRubberBandFunc mNodeRubberBandFunc = nullptr
 
QgsLayoutItemRubberBandFunc mRubberBandFunc = nullptr
 
QgsLayoutItemWidgetFunc mWidgetFunc = nullptr
 

Additional Inherited Members

 Flags for controlling how a items behave in the GUI. More...

Detailed Description

Convenience metadata class that uses static functions to handle layout item GUI behavior.

Note
not available in Python bindings
Since
QGIS 3.0

Definition at line 183 of file qgslayoutitemguiregistry.h.

Constructor & Destructor Documentation

◆ QgsLayoutItemGuiMetadata()

QgsLayoutItemGuiMetadata::QgsLayoutItemGuiMetadata ( int  type,
const QString &  visibleName,
const QIcon &  creationIcon,
const QgsLayoutItemWidgetFunc pfWidget = nullptr,
const QgsLayoutItemRubberBandFunc pfRubberBand = nullptr,
const QString &  groupId = QString(),
bool  isNodeBased = false,
QgsLayoutItemAbstractGuiMetadata::Flags  flags = QgsLayoutItemAbstractGuiMetadata::Flags(),
const QgsLayoutItemCreateFunc pfCreateFunc = nullptr 
)
inline

Constructor for QgsLayoutItemGuiMetadata with the specified class type and creationIcon, and function pointers for the various configuration widget creation functions.

visibleName should be set to a translated, user visible name identifying the corresponding layout item.

An optional groupId can be set, which allows grouping of related layout item classes. See QgsLayoutItemGuiMetadata for details.

If isNodeBased is true, then the corresponding item is a node based item.

Definition at line 198 of file qgslayoutitemguiregistry.h.

Member Function Documentation

◆ createItem()

QgsLayoutItem * QgsLayoutItemGuiMetadata::createItem ( QgsLayout layout)
overridevirtual

Creates an instance of the corresponding item type.

Reimplemented from QgsLayoutItemAbstractGuiMetadata.

Definition at line 165 of file qgslayoutitemguiregistry.cpp.

◆ createItemWidget()

QgsLayoutItemBaseWidget* QgsLayoutItemGuiMetadata::createItemWidget ( QgsLayoutItem item)
inlineoverridevirtual

Creates a configuration widget for an item of this type.

Can return nullptr if no configuration GUI is required.

Reimplemented from QgsLayoutItemAbstractGuiMetadata.

Definition at line 272 of file qgslayoutitemguiregistry.h.

◆ createNodeRubberBand()

QAbstractGraphicsShapeItem* QgsLayoutItemGuiMetadata::createNodeRubberBand ( QgsLayoutView view)
inlineoverridevirtual

Creates a rubber band for use when creating layout node based items of this type.

Can return nullptr if no rubber band should be created. The default behavior is to return nullptr.

See also
createRubberBand()

Reimplemented from QgsLayoutItemAbstractGuiMetadata.

Definition at line 274 of file qgslayoutitemguiregistry.h.

◆ createRubberBand()

QgsLayoutViewRubberBand* QgsLayoutItemGuiMetadata::createRubberBand ( QgsLayoutView view)
inlineoverridevirtual

Creates a rubber band for use when creating layout items of this type.

Can return nullptr if no rubber band should be created. The default behavior is to create a rectangular rubber band.

See also
createNodeRubberBand()

Reimplemented from QgsLayoutItemAbstractGuiMetadata.

Definition at line 273 of file qgslayoutitemguiregistry.h.

◆ creationIcon()

QIcon QgsLayoutItemGuiMetadata::creationIcon ( ) const
inlineoverridevirtual

Returns an icon representing creation of the layout item type.

Reimplemented from QgsLayoutItemAbstractGuiMetadata.

Definition at line 271 of file qgslayoutitemguiregistry.h.

◆ itemAddToLayoutFunction()

QgsLayoutItemAddedToLayoutFunc QgsLayoutItemGuiMetadata::itemAddToLayoutFunction ( ) const
inline

Returns the classes' item added to layout function.

See also
setItemAddedToLayoutFunction()

Definition at line 263 of file qgslayoutitemguiregistry.h.

◆ itemCreationFunction()

QgsLayoutItemCreateFunc QgsLayoutItemGuiMetadata::itemCreationFunction ( ) const
inline

Returns the classes' item creation function.

See also
setItemCreationFunction()

Definition at line 251 of file qgslayoutitemguiregistry.h.

◆ newItemAddedToLayout() [1/2]

void QgsLayoutItemGuiMetadata::newItemAddedToLayout ( QgsLayoutItem item)
overridevirtual

Called when a newly created item of the associated type 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.

Reimplemented from QgsLayoutItemAbstractGuiMetadata.

Definition at line 170 of file qgslayoutitemguiregistry.cpp.

◆ newItemAddedToLayout() [2/2]

void QgsLayoutItemGuiMetadata::newItemAddedToLayout ( QgsLayoutItem item,
const QVariantMap &  properties 
)

Called when a newly created item of the associated type 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.

The properties map will be filled with any custom properties which were specified during the item creation.

Since
QGIS 3.18

Definition at line 176 of file qgslayoutitemguiregistry.cpp.

◆ nodeRubberBandCreationFunction()

QgsLayoutNodeItemRubberBandFunc QgsLayoutItemGuiMetadata::nodeRubberBandCreationFunction ( ) const
inline

Returns the classes' node based rubber band creation function.

See also
setNodeRubberBandCreationFunction()

Definition at line 239 of file qgslayoutitemguiregistry.h.

◆ rubberBandCreationFunction()

QgsLayoutItemRubberBandFunc QgsLayoutItemGuiMetadata::rubberBandCreationFunction ( ) const
inline

Returns the classes' rubber band creation function.

See also
setRubberBandCreationFunction()

Definition at line 227 of file qgslayoutitemguiregistry.h.

◆ setItemAddedToLayoutFunction()

void QgsLayoutItemGuiMetadata::setItemAddedToLayoutFunction ( const QgsLayoutItemAddedToLayoutFunc function)
inline

Sets the classes' item creation function.

See also
itemAddToLayoutFunction()

Definition at line 269 of file qgslayoutitemguiregistry.h.

◆ setItemCreationFunction()

void QgsLayoutItemGuiMetadata::setItemCreationFunction ( const QgsLayoutItemCreateFunc function)
inline

Sets the classes' item creation function.

See also
itemCreationFunction()

Definition at line 257 of file qgslayoutitemguiregistry.h.

◆ setNodeRubberBandCreationFunction()

void QgsLayoutItemGuiMetadata::setNodeRubberBandCreationFunction ( const QgsLayoutNodeItemRubberBandFunc function)
inline

Sets the classes' node based rubber band creation function.

See also
nodeRubberBandCreationFunction()

Definition at line 245 of file qgslayoutitemguiregistry.h.

◆ setRubberBandCreationFunction()

void QgsLayoutItemGuiMetadata::setRubberBandCreationFunction ( const QgsLayoutItemRubberBandFunc function)
inline

Sets the classes' rubber band creation function.

See also
rubberBandCreationFunction()

Definition at line 233 of file qgslayoutitemguiregistry.h.

◆ setWidgetFunction()

void QgsLayoutItemGuiMetadata::setWidgetFunction ( const QgsLayoutItemWidgetFunc function)
inline

Sets the classes' configuration widget creation function.

See also
widgetFunction()

Definition at line 221 of file qgslayoutitemguiregistry.h.

◆ widgetFunction()

QgsLayoutItemWidgetFunc QgsLayoutItemGuiMetadata::widgetFunction ( ) const
inline

Returns the classes' configuration widget creation function.

See also
setWidgetFunction()

Definition at line 215 of file qgslayoutitemguiregistry.h.

Member Data Documentation

◆ mAddedToLayoutFunc

QgsLayoutItemAddedToLayoutFunc QgsLayoutItemGuiMetadata::mAddedToLayoutFunc = nullptr
protected

Definition at line 298 of file qgslayoutitemguiregistry.h.

◆ mCreateFunc

QgsLayoutItemCreateFunc QgsLayoutItemGuiMetadata::mCreateFunc = nullptr
protected

Definition at line 297 of file qgslayoutitemguiregistry.h.

◆ mIcon

QIcon QgsLayoutItemGuiMetadata::mIcon
protected

Definition at line 293 of file qgslayoutitemguiregistry.h.

◆ mNodeRubberBandFunc

QgsLayoutNodeItemRubberBandFunc QgsLayoutItemGuiMetadata::mNodeRubberBandFunc = nullptr
protected

Definition at line 296 of file qgslayoutitemguiregistry.h.

◆ mRubberBandFunc

QgsLayoutItemRubberBandFunc QgsLayoutItemGuiMetadata::mRubberBandFunc = nullptr
protected

Definition at line 295 of file qgslayoutitemguiregistry.h.

◆ mWidgetFunc

QgsLayoutItemWidgetFunc QgsLayoutItemGuiMetadata::mWidgetFunc = nullptr
protected

Definition at line 294 of file qgslayoutitemguiregistry.h.


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