QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
52 qDeleteAll( mMetadata );
57 return mMetadata.value( metadataId );
62 for (
auto it = mMetadata.constBegin(); it != mMetadata.constEnd(); ++it )
64 if ( it.value()->type() == type )
75 const int id = mMetadata.count();
76 mMetadata[id] = metadata;
83 if ( mItemGroups.contains( group.
id ) )
86 mItemGroups.insert( group.
id, group );
92 return mItemGroups[ id ];
97 if ( !mMetadata.contains( metadataId ) )
100 std::unique_ptr< QgsLayoutItem > item( mMetadata.value( metadataId )->createItem( layout ) );
102 return item.release();
104 const int type = mMetadata.value( metadataId )->type();
110 if ( !mMetadata.contains( metadataId ) )
115 metadata->newItemAddedToLayout( item, properties );
119 mMetadata.value( metadataId )->newItemAddedToLayout( item );
128 int type = item->
type();
133 type = multiFrame->
type();
135 for (
auto it = mMetadata.constBegin(); it != mMetadata.constEnd(); ++it )
137 if ( it.value()->type() == type )
138 return it.value()->createItemWidget( item );
146 if ( !mMetadata.contains( metadataId ) )
149 return mMetadata[metadataId]->createRubberBand( view );
154 if ( !mMetadata.contains( metadataId ) )
157 return mMetadata[metadataId]->createNodeRubberBand( view );
162 return mMetadata.keys();
QgsLayoutItemBaseWidget * createItemWidget(QgsLayoutItem *item) const
Creates a new instance of a layout item configuration widget for the specified item.
QgsLayoutItemAbstractGuiMetadata * itemMetadata(int metadataId) const
Returns the metadata for the specified item metadataId.
Stores GUI metadata about a group of layout item classes.
QgsLayoutViewRubberBand * createItemRubberBand(int metadataId, QgsLayoutView *view) const
Creates a new rubber band item for the specified item metadataId and destination view.
QgsLayoutItem * createItem(int type, QgsLayout *layout) const
Creates a new instance of a layout item given the item type, and target layout.
QgsLayoutViewRectangularRubberBand is rectangular rubber band for use within QgsLayoutView widgets.
~QgsLayoutItemGuiRegistry() override
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.
Abstract base class for layout items with the ability to distribute the content to several frames (Qg...
QgsLayoutItemGuiRegistry(QObject *parent=nullptr)
Creates a new empty item GUI registry.
int type() const override
Returns a unique graphics item type identifier.
void typeAdded(int metadataId)
Emitted whenever a new item type is added to the registry, with the specified metadataId.
virtual int type() const =0
Returns unique multiframe type id.
QString id
Unique (untranslated) group ID string.
int metadataIdForItemType(int type) const
Returns the GUI item metadata ID which corresponds to the specified layout item type.
bool addItemGroup(const QgsLayoutItemGuiGroup &group)
Registers a new item group with the registry.
Base class for graphical items within a QgsLayout.
QgsLayoutItem * createItem(int metadataId, QgsLayout *layout) const
Creates a new instance of a layout item given the item metadata metadataId, target layout.
QAbstractGraphicsShapeItem * createNodeItemRubberBand(int metadataId, QgsLayoutView *view)
Creates a rubber band for the specified item metadataId and destination view.
const QgsLayoutItemGuiGroup & itemGroup(const QString &id)
Returns a reference to the item group with matching id.
static QgsLayoutItemRegistry * layoutItemRegistry()
Returns the application's layout item registry, used for layout item types.
bool addLayoutItemGuiMetadata(QgsLayoutItemAbstractGuiMetadata *metadata)
Registers the gui metadata for a new layout item type.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
QList< int > itemMetadataIds() const
Returns a list of available item metadata ids handled by the registry.
A graphical widget to display and interact with QgsLayouts.
QgsLayoutViewRubberBand is an abstract base class for temporary rubber band items in various shapes,...
@ LayoutFrame
Frame item, part of a QgsLayoutMultiFrame object.