QgsLayoutItemAbstractGuiMetadata class
Stores GUI metadata about one layout item class.
Contents
This is a companion to QgsLayoutItemAbstractMetadata, storing only the components related to the GUI behavior of a layout item.
Derived classes
- class QgsLayoutItemGuiMetadata
- Convenience metadata class that uses static functions to handle layout item GUI behavior.
Public types
- enum Flag { FlagNoCreationTools = 1 << 1 }
- Flags for controlling how a items behave in the GUI.
Constructors, destructors, conversion operators
- QgsLayoutItemAbstractGuiMetadata(int type, const QString& visibleName, const QString& groupId = QString(), bool isNodeBased = false, Flags flags = nullptr)
- Constructor for QgsLayoutItemAbstractGuiMetadata with the specified class type.
Public functions
- auto createItem(QgsLayout* layout) -> QgsLayoutItem* virtual
- Creates an instance of the corresponding item type.
- auto createItemWidget(QgsLayoutItem* item) -> QgsLayoutItemBaseWidget* virtual
- Creates a configuration widget for an item of this type.
- auto createNodeRubberBand(QgsLayoutView* view) -> QAbstractGraphicsShapeItem* virtual
- Creates a rubber band for use when creating layout node based items of this type.
- auto createRubberBand(QgsLayoutView* view) -> QgsLayoutViewRubberBand* virtual
- Creates a rubber band for use when creating layout items of this type.
- auto creationIcon() const -> QIcon virtual
- Returns an icon representing creation of the layout item type.
- auto flags() const -> Flags
- Returns item flags.
- auto groupId() const -> QString
- Returns the item group ID, if set.
- auto isNodeBased() const -> bool
- Returns true if the associated item is a node based item.
- void newItemAddedToLayout(QgsLayoutItem* item) virtual
- Called when a newly created item of the associated type has been added to a layout.
- auto type() const -> int
- Returns the unique item type code for the layout item class.
- auto visibleName() const -> QString
- Returns a translated, user visible name identifying the corresponding layout item.
Enum documentation
enum QgsLayoutItemAbstractGuiMetadata:: Flag
Flags for controlling how a items behave in the GUI.
| Enumerators | |
|---|---|
| FlagNoCreationTools |
Do not show item creation tools for the item type. |
Function documentation
QgsLayoutItemAbstractGuiMetadata:: QgsLayoutItemAbstractGuiMetadata(int type,
const QString& visibleName,
const QString& groupId = QString(),
bool isNodeBased = false,
Flags flags = nullptr)
Constructor for QgsLayoutItemAbstractGuiMetadata with the specified class type.
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.
QgsLayoutItemBaseWidget* QgsLayoutItemAbstractGuiMetadata:: createItemWidget(QgsLayoutItem* item) virtual
Creates a configuration widget for an item of this type.
Can return nullptr if no configuration GUI is required.
QAbstractGraphicsShapeItem* QgsLayoutItemAbstractGuiMetadata:: createNodeRubberBand(QgsLayoutView* view) virtual
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.
QgsLayoutViewRubberBand* QgsLayoutItemAbstractGuiMetadata:: createRubberBand(QgsLayoutView* view) virtual
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.
void QgsLayoutItemAbstractGuiMetadata:: newItemAddedToLayout(QgsLayoutItem* item) virtual
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.