QGIS/python/gui/layout/qgslayoutitemguiregistry.sip

273 lines
7.6 KiB
Plaintext
Raw Normal View History

/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/layout/qgslayoutitemguiregistry.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsLayoutItemAbstractGuiMetadata
{
%Docstring
Stores GUI metadata about one layout item class.
2017-12-15 10:36:55 -04:00
This is a companion to QgsLayoutItemAbstractMetadata, storing only
the components related to the GUI behavior of a layout item.
.. note::
In C++ you can use QgsLayoutItemGuiMetadata convenience class.
2017-12-15 10:36:55 -04:00
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgslayoutitemguiregistry.h"
%End
public:
enum Flag
{
FlagNoCreationTools,
};
typedef QFlags<QgsLayoutItemAbstractGuiMetadata::Flag> Flags;
2017-10-17 17:39:55 +10:00
QgsLayoutItemAbstractGuiMetadata( int type, const QString &visibleName, const QString &groupId = QString(), bool isNodeBased = false, Flags flags = 0 );
%Docstring
2017-12-15 10:36:55 -04:00
Constructor for QgsLayoutItemAbstractGuiMetadata with the specified class ``type``.
2017-12-15 10:36:55 -04:00
``visibleName`` should be set to a translated, user visible name identifying the corresponding layout item.
2017-12-15 10:36:55 -04:00
An optional ``groupId`` can be set, which allows grouping of related layout item classes. See QgsLayoutItemGuiMetadata for details.
2017-10-17 17:39:55 +10:00
2017-12-15 10:36:55 -04:00
If ``isNodeBased`` is true, then the corresponding item is a node based item.
%End
virtual ~QgsLayoutItemAbstractGuiMetadata();
int type() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the unique item type code for the layout item class.
%End
Flags flags() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns item flags.
%End
QString groupId() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the item group ID, if set.
%End
2017-10-17 17:39:55 +10:00
bool isNodeBased() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns true if the associated item is a node based item.
2017-10-17 17:39:55 +10:00
%End
QString visibleName() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns a translated, user visible name identifying the corresponding layout item.
%End
virtual QIcon creationIcon() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns an icon representing creation of the layout item type.
%End
virtual QgsLayoutItemBaseWidget *createItemWidget( QgsLayoutItem *item ) /Factory/;
%Docstring
2017-12-15 10:36:55 -04:00
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 ) /Factory/;
%Docstring
2017-12-15 10:36:55 -04:00
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.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`createNodeRubberBand()`
%End
2017-10-17 17:39:55 +10:00
virtual QAbstractGraphicsShapeItem *createNodeRubberBand( QgsLayoutView *view ) /Factory/;
%Docstring
2017-12-15 10:36:55 -04:00
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.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`createRubberBand()`
2017-10-17 17:39:55 +10:00
%End
virtual QgsLayoutItem *createItem( QgsLayout *layout ) /Factory/;
%Docstring
2017-12-15 10:36:55 -04:00
Creates an instance of the corresponding item type.
%End
2017-10-20 17:23:12 +10:00
virtual void newItemAddedToLayout( QgsLayoutItem *item );
%Docstring
2017-12-15 10:36:55 -04:00
Called when a newly created item of the associated type has been added to a layout.
2017-10-20 17:23:12 +10:00
2017-12-15 10:36:55 -04:00
This is only called for additions which result from GUI operations - i.e. it is not
called for items added from templates.
2017-10-20 17:23:12 +10:00
%End
};
2017-10-17 17:39:55 +10:00
2017-10-20 17:23:12 +10:00
class QgsLayoutItemGuiGroup
{
%Docstring
Stores GUI metadata about a group of layout item classes.
2017-12-15 10:36:55 -04:00
QgsLayoutItemGuiGroup stores settings about groups of related layout item classes
which should be presented to users grouped together.
2017-12-15 10:36:55 -04:00
For instance, the various basic shape creation tools would use QgsLayoutItemGuiGroup
to display grouped within designer dialogs.
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgslayoutitemguiregistry.h"
%End
public:
QgsLayoutItemGuiGroup( const QString &id = QString(), const QString &name = QString(), const QIcon &icon = QIcon() );
%Docstring
2017-12-15 10:36:55 -04:00
Constructor for QgsLayoutItemGuiGroup.
%End
QString id;
%Docstring
2017-12-15 10:36:55 -04:00
Unique (untranslated) group ID string.
%End
QString name;
%Docstring
2017-12-15 10:36:55 -04:00
Translated group name.
%End
QIcon icon;
%Docstring
2017-12-15 10:36:55 -04:00
Icon for group.
%End
};
class QgsLayoutItemGuiRegistry : QObject
{
%Docstring
Registry of available layout item GUI behavior.
2017-12-15 10:36:55 -04:00
QgsLayoutItemGuiRegistry is not usually directly created, but rather accessed through
QgsGui.layoutItemGuiRegistry().
2017-12-15 10:36:55 -04:00
This acts as a companion to QgsLayoutItemRegistry, handling only
the components related to the GUI behavior of layout items.
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgslayoutitemguiregistry.h"
%End
public:
QgsLayoutItemGuiRegistry( QObject *parent = 0 );
%Docstring
2017-12-15 10:36:55 -04:00
Creates a new empty item GUI registry.
2017-12-15 10:36:55 -04:00
QgsLayoutItemGuiRegistry is not usually directly created, but rather accessed through
QgsGui.layoutItemGuiRegistry().
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`populate()`
%End
~QgsLayoutItemGuiRegistry();
QgsLayoutItemAbstractGuiMetadata *itemMetadata( int metadataId ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the metadata for the specified item ``metadataId``. Returns None if
a corresponding ``metadataId`` was not found in the registry.
%End
bool addLayoutItemGuiMetadata( QgsLayoutItemAbstractGuiMetadata *metadata /Transfer/ );
%Docstring
2017-12-15 10:36:55 -04:00
Registers the gui metadata for a new layout item type. Takes ownership of the metadata instance.
%End
bool addItemGroup( const QgsLayoutItemGuiGroup &group );
%Docstring
2017-12-15 10:36:55 -04:00
Registers a new item group with the registry. This must be done before calling
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).
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`itemGroup()`
%End
const QgsLayoutItemGuiGroup &itemGroup( const QString &id );
%Docstring
2017-12-15 10:36:55 -04:00
Returns a reference to the item group with matching ``id``.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`addItemGroup()`
%End
QgsLayoutItem *createItem( int metadataId, QgsLayout *layout ) const /Factory/;
%Docstring
2017-12-15 10:36:55 -04:00
Creates a new instance of a layout item given the item metadata ``metadataId``, target ``layout``.
%End
2017-10-20 17:23:12 +10:00
void newItemAddedToLayout( int metadataId, QgsLayoutItem *item );
%Docstring
2017-12-15 10:36:55 -04:00
Called when a newly created item of the associated metadata ``metadataId`` has been added to a layout.
2017-10-20 17:23:12 +10:00
2017-12-15 10:36:55 -04:00
This is only called for additions which result from GUI operations - i.e. it is not
called for items added from templates.
2017-10-20 17:23:12 +10:00
%End
QgsLayoutItemBaseWidget *createItemWidget( QgsLayoutItem *item ) const /Factory/;
%Docstring
2017-12-15 10:36:55 -04:00
Creates a new instance of a layout item configuration widget for the specified ``item``.
%End
2017-10-17 17:39:55 +10:00
QList< int > itemMetadataIds() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns a list of available item metadata ids handled by the registry.
%End
signals:
void typeAdded( int metadataId );
%Docstring
2017-12-15 10:36:55 -04:00
Emitted whenever a new item type is added to the registry, with the specified
``metadataId``.
%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.pl again *
************************************************************************/