QGIS/python/core/auto_generated/qgsfieldformatter.sip.in

163 lines
4.9 KiB
Plaintext
Raw Normal View History

2017-05-01 12:59:18 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsfieldformatter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsFieldFormatterContext
{
%Docstring
A context for field formatter containing information like the project
.. versionadded:: 3.12
%End
%TypeHeaderCode
#include "qgsfieldformatter.h"
%End
public:
QgsFieldFormatterContext();
%Docstring
Constructor
%End
QgsProject *project() const;
%Docstring
Returns the project used in field formatter
.. seealso:: :py:func:`setProject`
%End
void setProject( QgsProject *project );
%Docstring
Sets the ``project`` used in field formatter
.. seealso:: :py:func:`project`
%End
};
class QgsFieldFormatter
2016-12-04 17:23:37 +01:00
{
2017-05-01 12:59:18 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
A field formatter helps to handle and display values for a field.
2017-05-01 12:59:18 +02:00
2017-12-15 10:36:55 -04:00
It allows for using a shared configuration with the editor widgets
for representation of attribute values.
Field kits normally have one single instance which is managed by the
:py:class:`QgsFieldFormatterRegistry`. Custom field formatters should be registered there and
2017-12-15 10:36:55 -04:00
field formatters for use within code should normally be obtained from there.
2017-05-01 12:59:18 +02:00
2017-12-15 10:36:55 -04:00
This is an abstract base class and will always need to be subclassed.
2017-05-01 12:59:18 +02:00
.. versionadded:: 3.0
%End
2016-12-04 17:23:37 +01:00
%TypeHeaderCode
#include "qgsfieldformatter.h"
2016-12-04 17:23:37 +01:00
%End
public:
2019-09-24 07:53:11 +02:00
QgsFieldFormatter();
2019-09-24 07:53:11 +02:00
%Docstring
Default constructor
%End
2016-12-04 17:23:37 +01:00
virtual ~QgsFieldFormatter();
2016-12-04 17:23:37 +01:00
enum Flag
{
CanProvideAvailableValues
};
typedef QFlags<QgsFieldFormatter::Flag> Flags;
2016-12-04 17:23:37 +01:00
virtual QString id() const = 0;
2017-05-01 12:59:18 +02:00
%Docstring
Returns a unique id for this field formatter.
2017-12-19 11:43:52 -04:00
This id will later be used to identify this field formatter in the registry with :py:func:`QgsFieldFormatterRegistry.fieldFormatter()`
2017-05-01 12:59:18 +02:00
2017-12-19 11:43:52 -04:00
This id matches the id of a :py:class:`QgsEditorWidgetFactory`.
2017-05-01 12:59:18 +02:00
%End
virtual QString representValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Create a pretty String representation of the value.
:return: By default the string representation of the provided value as implied by the field definition is returned.
2016-12-04 17:23:37 +01:00
2017-05-01 12:59:18 +02:00
.. versionadded:: 3.0
%End
virtual QVariant sortValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const;
%Docstring
2017-12-15 10:36:55 -04:00
If the default sort order should be overwritten for this widget, you can transform the value in here.
:return: an unmodified value by default.
2017-05-01 12:59:18 +02:00
.. versionadded:: 3.0
%End
virtual Qt::AlignmentFlag alignmentFlag( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config ) const;
%Docstring
Returns the alignment for a particular field. By default this will consider the field type but can be overwritten if mapped
2017-12-15 10:36:55 -04:00
values are represented.
2017-05-01 12:59:18 +02:00
.. versionadded:: 3.0
%End
virtual QVariant createCache( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Create a cache for a given field.
This will be used in situations where a field is being represented various times in a loop. And will be passed
2017-12-19 11:43:52 -04:00
to other methods on QgsFieldKit and :py:class:`QgsEditorWidgetWrapper`.
2017-05-01 12:59:18 +02:00
2017-12-15 10:36:55 -04:00
For example, the attribute table will create a cache once for each field and then use this
2017-12-19 11:43:52 -04:00
cache for representation. The QgsValueRelationFieldFormatter and :py:class:`QgsValueRelationEditorWidget`
2017-12-15 10:36:55 -04:00
implement this functionality to create a lookuptable once (a QVariantMap / dict) and are
make use of a cache if present.
2016-12-04 17:23:37 +01:00
2017-05-01 12:59:18 +02:00
.. versionadded:: 3.0
%End
virtual QVariantList availableValues( const QVariantMap &config, int countLimit, const QgsFieldFormatterContext &context ) const;
%Docstring
Returns a list of the values that would be possible to select with this widget type
On a RelationReference that would be the parents ids or on ValueMap all the configured keys
according to the settings in the ``config``
.. versionadded:: 3.12
%End
Flags flags() const;
%Docstring
Returns the flags
2019-12-20 08:47:30 +01:00
.. versionadded:: 3.12
%End
void setFlags( const Flags &flags );
%Docstring
Sets the ``flags``
2019-12-20 08:47:30 +01:00
.. versionadded:: 3.12
%End
2016-12-04 17:23:37 +01:00
};
2017-05-01 12:59:18 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsfieldformatter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/