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

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

#include <qgslayoutitemguiregistry.h>

Inheritance diagram for QgsLayoutItemGuiMetadata:

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.
QgsLayoutItemcreateItem (QgsLayout *layout) override
 Creates an instance of the corresponding item type.
QgsLayoutItemBaseWidgetcreateItemWidget (QgsLayoutItem *item) override
 Creates a configuration widget for an item of this type.
QGraphicsItem * createNodeRubberBand (QgsLayoutView *view) override
 Creates a rubber band for use when creating layout node based items of this type.
QgsLayoutViewRubberBandcreateRubberBand (QgsLayoutView *view) override
 Creates a rubber band for use when creating layout items of this type.
QIcon creationIcon () const override
 Returns an icon representing creation of the layout item type.
void handleDoubleClick (QgsLayoutItem *item, Qgis::MouseHandlesAction action) override
 Called when a layout item is double-clicked.
QgsLayoutItemAddedToLayoutFunc itemAddToLayoutFunction () const
 Returns the classes' item added to layout function.
QgsLayoutItemCreateFunc itemCreationFunction () const
 Returns the classes' item creation function.
QgsLayoutItemDoubleClickedFunc itemDoubleClickedFunction () const
 Returns the classes' item double clicked function.
void newItemAddedToLayout (QgsLayoutItem *item) override
 Called when a newly created item of the associated type has been added to a layout.
void newItemAddedToLayout (QgsLayoutItem *item, const QVariantMap &properties)
 Called when a newly created item of the associated type has been added to a layout.
QgsLayoutNodeItemRubberBandFunc nodeRubberBandCreationFunction () const
 Returns the classes' node based rubber band creation function.
QgsLayoutItemRubberBandFunc rubberBandCreationFunction () const
 Returns the classes' rubber band creation function.
void setItemAddedToLayoutFunction (const QgsLayoutItemAddedToLayoutFunc &function)
 Sets the classes' item creation function.
void setItemCreationFunction (const QgsLayoutItemCreateFunc &function)
 Sets the classes' item creation function.
void setItemDoubleClickedFunction (const QgsLayoutItemDoubleClickedFunc &function)
 Sets the classes' item double clicked function.
void setNodeRubberBandCreationFunction (const QgsLayoutNodeItemRubberBandFunc &function)
 Sets the classes' node based rubber band creation function.
void setRubberBandCreationFunction (const QgsLayoutItemRubberBandFunc &function)
 Sets the classes' rubber band creation function.
void setWidgetFunction (const QgsLayoutItemWidgetFunc &function)
 Sets the classes' configuration widget creation function.
QgsLayoutItemWidgetFunc widgetFunction () const
 Returns the classes' configuration widget creation function.

Protected Attributes

QgsLayoutItemAddedToLayoutFunc mAddedToLayoutFunc = nullptr
QgsLayoutItemCreateFunc mCreateFunc = nullptr
QgsLayoutItemDoubleClickedFunc mDoubleClickedFunc = 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

Definition at line 195 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 209 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 211 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 292 of file qgslayoutitemguiregistry.h.

◆ createNodeRubberBand()

QGraphicsItem * 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 294 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 293 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 291 of file qgslayoutitemguiregistry.h.

◆ handleDoubleClick()

void QgsLayoutItemGuiMetadata::handleDoubleClick ( QgsLayoutItem * item,
Qgis::MouseHandlesAction action )
overridevirtual

Called when a layout item is double-clicked.

The action parameter is used to specify which mouse handle, if any, was clicked If no mouse handle is selected, Qgis::MouseHandlesAction::NoAction is used

Since
QGIS 3.42

Reimplemented from QgsLayoutItemAbstractGuiMetadata.

Definition at line 51 of file qgslayoutitemguiregistry.cpp.

◆ itemAddToLayoutFunction()

QgsLayoutItemAddedToLayoutFunc QgsLayoutItemGuiMetadata::itemAddToLayoutFunction ( ) const
inline

Returns the classes' item added to layout function.

See also
setItemAddedToLayoutFunction()

Definition at line 269 of file qgslayoutitemguiregistry.h.

◆ itemCreationFunction()

QgsLayoutItemCreateFunc QgsLayoutItemGuiMetadata::itemCreationFunction ( ) const
inline

Returns the classes' item creation function.

See also
setItemCreationFunction()

Definition at line 257 of file qgslayoutitemguiregistry.h.

◆ itemDoubleClickedFunction()

QgsLayoutItemDoubleClickedFunc QgsLayoutItemGuiMetadata::itemDoubleClickedFunction ( ) const
inline

Returns the classes' item double clicked function.

See also
setItemAddedToLayoutFunction()

Definition at line 281 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 216 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 222 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 245 of file qgslayoutitemguiregistry.h.

◆ rubberBandCreationFunction()

QgsLayoutItemRubberBandFunc QgsLayoutItemGuiMetadata::rubberBandCreationFunction ( ) const
inline

Returns the classes' rubber band creation function.

See also
setRubberBandCreationFunction()

Definition at line 233 of file qgslayoutitemguiregistry.h.

◆ setItemAddedToLayoutFunction()

void QgsLayoutItemGuiMetadata::setItemAddedToLayoutFunction ( const QgsLayoutItemAddedToLayoutFunc & function)
inline

Sets the classes' item creation function.

See also
itemAddToLayoutFunction()

Definition at line 275 of file qgslayoutitemguiregistry.h.

◆ setItemCreationFunction()

void QgsLayoutItemGuiMetadata::setItemCreationFunction ( const QgsLayoutItemCreateFunc & function)
inline

Sets the classes' item creation function.

See also
itemCreationFunction()

Definition at line 263 of file qgslayoutitemguiregistry.h.

◆ setItemDoubleClickedFunction()

void QgsLayoutItemGuiMetadata::setItemDoubleClickedFunction ( const QgsLayoutItemDoubleClickedFunc & function)
inline

Sets the classes' item double clicked function.

See also
itemDoubleClickedFunction()

Definition at line 287 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 251 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 239 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 227 of file qgslayoutitemguiregistry.h.

◆ widgetFunction()

QgsLayoutItemWidgetFunc QgsLayoutItemGuiMetadata::widgetFunction ( ) const
inline

Returns the classes' configuration widget creation function.

See also
setWidgetFunction()

Definition at line 221 of file qgslayoutitemguiregistry.h.

Member Data Documentation

◆ mAddedToLayoutFunc

QgsLayoutItemAddedToLayoutFunc QgsLayoutItemGuiMetadata::mAddedToLayoutFunc = nullptr
protected

Definition at line 318 of file qgslayoutitemguiregistry.h.

◆ mCreateFunc

QgsLayoutItemCreateFunc QgsLayoutItemGuiMetadata::mCreateFunc = nullptr
protected

Definition at line 317 of file qgslayoutitemguiregistry.h.

◆ mDoubleClickedFunc

QgsLayoutItemDoubleClickedFunc QgsLayoutItemGuiMetadata::mDoubleClickedFunc = nullptr
protected

Definition at line 319 of file qgslayoutitemguiregistry.h.

◆ mIcon

QIcon QgsLayoutItemGuiMetadata::mIcon
protected

Definition at line 313 of file qgslayoutitemguiregistry.h.

◆ mNodeRubberBandFunc

QgsLayoutNodeItemRubberBandFunc QgsLayoutItemGuiMetadata::mNodeRubberBandFunc = nullptr
protected

Definition at line 316 of file qgslayoutitemguiregistry.h.

◆ mRubberBandFunc

QgsLayoutItemRubberBandFunc QgsLayoutItemGuiMetadata::mRubberBandFunc = nullptr
protected

Definition at line 315 of file qgslayoutitemguiregistry.h.

◆ mWidgetFunc

QgsLayoutItemWidgetFunc QgsLayoutItemGuiMetadata::mWidgetFunc = nullptr
protected

Definition at line 314 of file qgslayoutitemguiregistry.h.


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