QGIS/python/core/layout/qgslayoutitemattributetable.sip

334 lines
9.2 KiB
Plaintext
Raw Normal View History

2017-11-22 07:43:05 +10:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgslayoutitemattributetable.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsLayoutItemAttributeTable: QgsLayoutTable
{
%Docstring
2017-12-15 10:36:55 -04:00
A layout table subclass that displays attributes from a vector layer.
2017-11-22 07:43:05 +10:00
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgslayoutitemattributetable.h"
%End
public:
enum ContentSource
{
LayerAttributes,
AtlasFeature,
RelationChildren
};
2017-11-22 17:46:13 +10:00
QgsLayoutItemAttributeTable( QgsLayout *layout /TransferThis/ );
2017-11-22 07:43:05 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Constructor for QgsLayoutItemAttributeTable, attached to the specified ``layout``.
2017-11-22 17:46:13 +10:00
2017-12-15 10:36:55 -04:00
Ownership is transferred to the layout.
2017-11-22 07:43:05 +10:00
%End
virtual int type() const;
virtual QString displayName() const;
static QgsLayoutItemAttributeTable *create( QgsLayout *layout ) /Factory/;
%Docstring
2017-12-15 10:36:55 -04:00
Returns a new QgsLayoutItemAttributeTable for the specified parent ``layout``.
:rtype: QgsLayoutItemAttributeTable
2017-11-22 07:43:05 +10:00
%End
void setSource( ContentSource source );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the ``source`` for attributes to show in table body.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`source()`
2017-11-22 07:43:05 +10:00
%End
ContentSource source() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the source for attributes shown in the table body.
:rtype: ContentSource
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setSource()`
2017-11-22 07:43:05 +10:00
%End
QgsVectorLayer *sourceLayer();
%Docstring
2017-12-15 10:36:55 -04:00
Returns the source layer for the table, considering the table source mode. For example,
if the table is set to atlas feature mode, then the source layer will be the
atlas coverage layer. If the table is set to layer attributes mode, then
the source layer will be the user specified vector layer.
:rtype: QgsVectorLayer
2017-11-22 07:43:05 +10:00
%End
void setVectorLayer( QgsVectorLayer *layer );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the vector ``layer`` from which to display feature attributes.
2017-11-22 07:43:05 +10:00
2017-12-15 10:36:55 -04:00
This is only considered if the table source() is LayerAttributes.
2017-11-22 07:43:05 +10:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`vectorLayer()`
2017-11-22 07:43:05 +10:00
%End
QgsVectorLayer *vectorLayer() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the vector layer the attribute table is currently using.
This is only considered if the table source() is LayerAttributes.
2017-11-22 07:43:05 +10:00
2017-12-15 10:36:55 -04:00
:rtype: QgsVectorLayer
2017-11-22 07:43:05 +10:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setVectorLayer()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`sourceLayer()`
2017-11-22 07:43:05 +10:00
%End
void setRelationId( const QString &id );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the relation ``id`` from which to display child features
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`relationId()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setSource()`
2017-12-15 10:36:55 -04:00
2017-11-22 07:43:05 +10:00
.. note::
Only used if table source() is set to RelationChildren.
%End
QString relationId() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the relation id which the table displays child features from.
:rtype: str
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setRelationId()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`source()`
2017-12-15 10:36:55 -04:00
2017-11-22 07:43:05 +10:00
.. note::
Only used if table source() is set to RelationChildren.
%End
void resetColumns();
%Docstring
2017-12-15 10:36:55 -04:00
Resets the attribute table's columns to match the vector layer's fields.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setVectorLayer()`
2017-11-22 07:43:05 +10:00
%End
void setMap( QgsLayoutItemMap *map );
%Docstring
2017-12-15 10:36:55 -04:00
Sets a layout ``map`` to use to limit the extent of features shown in the
attribute table. This setting only has an effect if setDisplayOnlyVisibleFeatures is
set to true. Changing the map forces the table to refetch features from its
vector layer, and may result in the table changing size to accommodate the new displayed
feature attributes.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`map()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setDisplayOnlyVisibleFeatures`
2017-11-22 07:43:05 +10:00
%End
QgsLayoutItemMap *map() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the layout map whose extents are controlling the features shown in the
table. The extents of the map are only used if displayOnlyVisibleFeatures() is true.
:rtype: QgsLayoutItemMap
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setMap()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`displayOnlyVisibleFeatures()`
2017-11-22 07:43:05 +10:00
%End
void setMaximumNumberOfFeatures( int features );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the maximum number of ``features`` shown by the table. Changing this setting may result
in the attribute table changing its size to accommodate the new number of rows, and requires
the table to refetch features from its vector layer.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`maximumNumberOfFeatures()`
2017-11-22 07:43:05 +10:00
%End
int maximumNumberOfFeatures() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the maximum number of features to be shown by the table.
:rtype: int
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setMaximumNumberOfFeatures()`
2017-11-22 07:43:05 +10:00
%End
void setUniqueRowsOnly( bool uniqueOnly );
%Docstring
2017-12-15 10:36:55 -04:00
Sets attribute table to only show unique rows.
2017-11-22 07:43:05 +10:00
2017-12-15 10:36:55 -04:00
Set ``uniqueOnly`` to true to show only unique rows. Duplicate rows
will be stripped from the table.
2017-11-22 07:43:05 +10:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`uniqueRowsOnly()`
2017-11-22 07:43:05 +10:00
%End
bool uniqueRowsOnly() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns true if the table is set to show only unique rows.
:rtype: bool
2017-11-22 07:43:05 +10:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setUniqueRowsOnly()`
2017-11-22 07:43:05 +10:00
%End
void setDisplayOnlyVisibleFeatures( bool visibleOnly );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the attribute table to only show features which are visible in a map item. Changing
this setting forces the table to refetch features from its vector layer, and may result in
the table changing size to accommodate the new displayed feature attributes.
2017-11-22 07:43:05 +10:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`displayOnlyVisibleFeatures()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setMap()`
2017-11-22 07:43:05 +10:00
%End
bool displayOnlyVisibleFeatures() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns true if the table is set to show only features visible on a corresponding
map item.
:rtype: bool
2017-11-22 07:43:05 +10:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`map()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setDisplayOnlyVisibleFeatures()`
2017-11-22 07:43:05 +10:00
%End
void setFilterToAtlasFeature( bool filterToAtlas );
%Docstring
2017-12-15 10:36:55 -04:00
Sets attribute table to only show features which intersect the current atlas
feature.
2017-11-22 07:43:05 +10:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`filterToAtlasFeature()`
2017-11-22 07:43:05 +10:00
%End
bool filterToAtlasFeature() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns true if the table is set to only show features which intersect the current atlas
feature.
:rtype: bool
2017-11-22 07:43:05 +10:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setFilterToAtlasFeature()`
2017-11-22 07:43:05 +10:00
%End
bool filterFeatures() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns true if a feature filter is active on the attribute table.
:rtype: bool
2017-11-22 07:43:05 +10:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setFilterFeatures()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`featureFilter()`
2017-11-22 07:43:05 +10:00
%End
void setFilterFeatures( bool filter );
%Docstring
2017-12-15 10:36:55 -04:00
Sets whether the feature filter is active for the attribute table. Changing
this setting forces the table to refetch features from its vector layer, and may result in
the table changing size to accommodate the new displayed feature attributes.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`filterFeatures()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setFeatureFilter()`
2017-11-22 07:43:05 +10:00
%End
QString featureFilter() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the current expression used to filter features for the table. The filter is only
active if filterFeatures() is true.
:rtype: str
2017-11-22 07:43:05 +10:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setFeatureFilter()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`filterFeatures()`
2017-11-22 07:43:05 +10:00
%End
void setFeatureFilter( const QString &expression );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the ``expression`` used for filtering features in the table. The filter is only
active if filterFeatures() is set to true. Changing this setting forces the table
to refetch features from its vector layer, and may result in
the table changing size to accommodate the new displayed feature attributes.
2017-11-22 07:43:05 +10:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`featureFilter()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setFilterFeatures()`
2017-11-22 07:43:05 +10:00
%End
void setDisplayedFields( const QStringList &fields, bool refresh = true );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the attributes to display in the table.
:param fields: list of fields names from the vector layer to show.
Set to an empty list to show all feature attributes.
:param refresh: set to true to force the table to refetch features from its vector layer
and immediately update the display of the table. This may result in the table changing size
to accommodate the new displayed feature attributes.
2017-11-22 07:43:05 +10:00
%End
void setWrapString( const QString &wrapString );
%Docstring
2017-12-15 10:36:55 -04:00
Sets a string to wrap the contents of the table cells by. Occurrences of this string will
be replaced by a line break.
:param wrapString: string to replace with line break
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`wrapString()`
2017-11-22 07:43:05 +10:00
%End
QString wrapString() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the string used to wrap the contents of the table cells by. Occurrences of this string will
be replaced by a line break.
:rtype: str
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setWrapString()`
2017-11-22 07:43:05 +10:00
%End
virtual QgsExpressionContext createExpressionContext() const;
protected:
virtual bool writePropertiesToElement( QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context ) const;
virtual bool readPropertiesFromElement( const QDomElement &itemElem, const QDomDocument &doc, const QgsReadWriteContext &context );
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgslayoutitemattributetable.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/