QGIS/python/gui/auto_generated/layout/qgslayoutitemguiregistry.sip.in
Yoann Quenach de Quivillic 91e25e8051 Apply suggestions from review
2025-07-07 11:08:27 +12:00

342 lines
9.6 KiB
Plaintext

/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/layout/qgslayoutitemguiregistry.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsLayoutItemAbstractGuiMetadata
{
%Docstring(signature="appended")
Stores GUI metadata about one layout item class.
This is a companion to :py:class:`QgsLayoutItemAbstractMetadata`,
storing only the components related to the GUI behavior of a layout
item.
.. note::
In C++ you can use :py:class:`QgsLayoutItemGuiMetadata` convenience class.
%End
%TypeHeaderCode
#include "qgslayoutitemguiregistry.h"
%End
public:
enum Flag
{
FlagNoCreationTools,
};
typedef QFlags<QgsLayoutItemAbstractGuiMetadata::Flag> Flags;
QgsLayoutItemAbstractGuiMetadata( int type, const QString &visibleName, const QString &groupId = QString(), bool isNodeBased = false, Flags flags = QgsLayoutItemAbstractGuiMetadata::Flags() );
%Docstring
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 :py:class:`QgsLayoutItemGuiMetadata` for
details.
If ``isNodeBased`` is ``True``, then the corresponding item is a node
based item.
%End
virtual ~QgsLayoutItemAbstractGuiMetadata();
int type() const;
%Docstring
Returns the unique item type code for the layout item class.
%End
Flags flags() const;
%Docstring
Returns item flags.
%End
QString groupId() const;
%Docstring
Returns the item group ID, if set.
%End
bool isNodeBased() const;
%Docstring
Returns ``True`` if the associated item is a node based item.
%End
QString visibleName() const;
%Docstring
Returns a translated, user visible name identifying the corresponding
layout item.
%End
virtual QIcon creationIcon() const;
%Docstring
Returns an icon representing creation of the layout item type.
%End
virtual QgsLayoutItemBaseWidget *createItemWidget( QgsLayoutItem *item ) /TransferBack/;
%Docstring
Creates a configuration widget for an ``item`` of this type. Can return
``None`` if no configuration GUI is required.
%End
virtual QgsLayoutViewRubberBand *createRubberBand( QgsLayoutView *view ) /TransferBack/;
%Docstring
Creates a rubber band for use when creating layout items of this type.
Can return ``None`` if no rubber band should be created. The default
behavior is to create a rectangular rubber band.
.. seealso:: :py:func:`createNodeRubberBand`
%End
virtual QGraphicsItem *createNodeRubberBand( QgsLayoutView *view ) /TransferBack/;
%Docstring
Creates a rubber band for use when creating layout node based items of
this type. Can return ``None`` if no rubber band should be created. The
default behavior is to return ``None``.
.. seealso:: :py:func:`createRubberBand`
%End
virtual QgsLayoutItem *createItem( QgsLayout *layout ) /TransferBack/;
%Docstring
Creates an instance of the corresponding item type.
%End
virtual void newItemAddedToLayout( QgsLayoutItem *item );
%Docstring
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.
%End
virtual void handleDoubleClick( QgsLayoutItem *item, Qgis::MouseHandlesAction action );
%Docstring
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, :py:class:`Qgis`.MouseHandlesAction.NoAction is used
.. versionadded:: 3.42
%End
};
class QgsLayoutItemGuiGroup
{
%Docstring(signature="appended")
Stores GUI metadata about a group of layout item classes.
:py:class:`QgsLayoutItemGuiGroup` stores settings about groups of
related layout item classes which should be presented to users grouped
together.
For instance, the various basic shape creation tools would use
:py:class:`QgsLayoutItemGuiGroup` to display grouped within designer
dialogs.
%End
%TypeHeaderCode
#include "qgslayoutitemguiregistry.h"
%End
public:
QgsLayoutItemGuiGroup( const QString &id = QString(), const QString &name = QString(), const QIcon &icon = QIcon() );
%Docstring
Constructor for QgsLayoutItemGuiGroup.
%End
QString id;
QString name;
QIcon icon;
};
class QgsLayoutItemGuiRegistry : QObject
{
%Docstring(signature="appended")
Registry of available layout item GUI behavior.
:py:class:`QgsLayoutItemGuiRegistry` is not usually directly created,
but rather accessed through :py:func:`QgsGui.layoutItemGuiRegistry()`.
This acts as a companion to :py:class:`QgsLayoutItemRegistry`, handling
only the components related to the GUI behavior of layout items.
%End
%TypeHeaderCode
#include "qgslayoutitemguiregistry.h"
%End
public:
QgsLayoutItemGuiRegistry( QObject *parent = 0 );
%Docstring
Creates a new empty item GUI registry.
QgsLayoutItemGuiRegistry is not usually directly created, but rather
accessed through :py:func:`QgsGui.layoutItemGuiRegistry()`.
%End
~QgsLayoutItemGuiRegistry();
QgsLayoutItemAbstractGuiMetadata *itemMetadata( int metadataId ) const;
%Docstring
Returns the metadata for the specified item ``metadataId``. Returns
``None`` if a corresponding ``metadataId`` was not found in the
registry.
%End
int metadataIdForItemType( int type ) const;
%Docstring
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.
.. versionadded:: 3.18
%End
bool addLayoutItemGuiMetadata( QgsLayoutItemAbstractGuiMetadata *metadata /Transfer/ );
%Docstring
Registers the GUI metadata for a new layout item type. Takes ownership
of the metadata instance.
%End
bool removeLayoutItemGuiMetadata( int type );
%Docstring
Unregisters the GUI metadata for a layout item type.
.. versionadded:: 4.0
%End
bool removeLayoutItemGuiMetadata( QgsLayoutItemAbstractGuiMetadata *metadata );
%Docstring
Unregisters the GUI metadata for a layout item type.
The ``metadata`` object will be deleted and should not be used after
this call.
.. versionadded:: 4.0
%End
bool addItemGroup( const QgsLayoutItemGuiGroup &group );
%Docstring
Registers a new item group with the registry. This must be done before
calling :py:func:`~QgsLayoutItemGuiRegistry.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).
.. seealso:: :py:func:`itemGroup`
%End
bool removeItemGroup( const QString &id );
%Docstring
Unregisters an item group from the registry.
This must be done after calling
:py:func:`~QgsLayoutItemGuiRegistry.removeLayoutItemGuiMetadata` for
every item types associated with the group.
.. versionadded:: 4.0
%End
const QgsLayoutItemGuiGroup &itemGroup( const QString &id );
%Docstring
Returns a reference to the item group with matching ``id``.
.. seealso:: :py:func:`addItemGroup`
%End
QgsLayoutItem *createItem( int metadataId, QgsLayout *layout ) const /TransferBack/;
%Docstring
Creates a new instance of a layout item given the item metadata
``metadataId``, target ``layout``.
%End
void newItemAddedToLayout( int metadataId, QgsLayoutItem *item, const QVariantMap &properties = QVariantMap() );
%Docstring
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
:py:func:`QgsLayoutItemGuiMetadata.newItemAddedToLayout()` function.
%End
QgsLayoutItemBaseWidget *createItemWidget( QgsLayoutItem *item ) const /TransferBack/;
%Docstring
Creates a new instance of a layout item configuration widget for the
specified ``item``.
%End
QList<int> itemMetadataIds() const;
%Docstring
Returns a list of available item metadata ids handled by the registry.
%End
signals:
void typeAdded( int metadataId );
%Docstring
Emitted whenever a new item type is added to the registry, with the
specified ``metadataId``.
%End
void typeRemoved( int metadataId );
%Docstring
Emitted whenever an item type is removed from the registry, with the
specified ``metadataId``.
.. versionadded:: 4.0
%End
void groupRemoved( QString groupId );
%Docstring
Emitted whenever an item group is removed from the registry.
.. versionadded:: 4.0
%End
private:
QgsLayoutItemGuiRegistry( const QgsLayoutItemGuiRegistry &rh );
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/layout/qgslayoutitemguiregistry.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/