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

200 lines
5.3 KiB
Plaintext
Raw Normal View History

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsfieldmodel.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsFieldModel : QAbstractItemModel
{
%Docstring
2020-03-16 19:17:56 +01:00
The QgsFieldModel class is a model to display the list of fields in widgets
(optionally associated with a vector layer).
2017-12-15 10:36:55 -04:00
If allowed, expressions might be added to the end of the model.
It can be associated with a QgsMapLayerModel to dynamically display a layer and its fields.
.. versionadded:: 2.3
%End
%TypeHeaderCode
#include "qgsfieldmodel.h"
%End
public:
enum FieldRoles
{
2017-06-08 15:50:48 +02:00
FieldNameRole,
FieldIndexRole,
ExpressionRole,
IsExpressionRole,
ExpressionValidityRole,
FieldTypeRole,
FieldOriginRole,
IsEmptyRole,
EditorWidgetType,
JoinedFieldIsEditable,
FieldIsWidgetEditable,
};
explicit QgsFieldModel( QObject *parent /TransferThis/ = 0 );
%Docstring
2017-12-15 10:36:55 -04:00
Constructor for QgsFieldModel - creates a model to display the fields of a given layer.
%End
QModelIndex indexFromName( const QString &fieldName );
%Docstring
2017-12-15 10:36:55 -04:00
Returns the index corresponding to a given fieldName.
%End
void setAllowExpression( bool allowExpression );
%Docstring
2017-12-15 10:36:55 -04:00
Sets whether custom expressions are accepted and displayed in the model.
.. seealso:: :py:func:`allowExpression`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setExpression`
%End
bool allowExpression();
%Docstring
2019-02-26 19:54:09 +10:00
Returns ``True`` if the model allows custom expressions to be created and displayed.
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setAllowExpression`
%End
void setAllowEmptyFieldName( bool allowEmpty );
%Docstring
2017-12-15 10:36:55 -04:00
Sets whether an optional empty field ("not set") option is present in the model.
.. seealso:: :py:func:`allowEmptyFieldName`
2017-12-15 10:36:55 -04:00
.. versionadded:: 3.0
%End
bool allowEmptyFieldName() const;
%Docstring
2019-02-26 19:54:09 +10:00
Returns ``True`` if the model allows the empty field ("not set") choice.
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`setAllowEmptyFieldName`
2017-12-15 10:36:55 -04:00
.. versionadded:: 3.0
%End
bool isField( const QString &expression ) const;
%Docstring
2019-02-26 19:54:09 +10:00
Returns ``True`` if a string represents a field reference, or ``False`` if it is an
2017-12-15 10:36:55 -04:00
expression consisting of more than direct field reference.
%End
void setExpression( const QString &expression );
%Docstring
2017-12-15 10:36:55 -04:00
Sets a single expression to be added after the fields at the end of the model.
.. seealso:: :py:func:`setAllowExpression`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`allowExpression`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`removeExpression`
%End
void removeExpression();
%Docstring
2017-12-15 10:36:55 -04:00
Removes any custom expression from the model.
.. seealso:: :py:func:`setExpression`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`allowExpression`
%End
QgsVectorLayer *layer();
%Docstring
2017-12-15 10:36:55 -04:00
Returns the layer associated with the model.
.. seealso:: :py:func:`setLayer`
%End
virtual QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const;
2017-04-20 13:48:50 +02:00
virtual QModelIndex parent( const QModelIndex &child ) const;
2017-04-20 13:48:50 +02:00
virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const;
2017-04-20 13:48:50 +02:00
virtual int columnCount( const QModelIndex &parent ) const;
2017-04-20 13:48:50 +02:00
virtual QVariant data( const QModelIndex &index, int role ) const;
2017-04-20 13:48:50 +02:00
static QString fieldToolTip( const QgsField &field );
%Docstring
Returns a HTML formatted tooltip string for a ``field``, containing details
like the field name, alias and type.
.. versionadded:: 3.0
%End
static QString fieldToolTipExtended( const QgsField &field, const QgsVectorLayer *layer );
%Docstring
Returns a HTML formatted tooltip string for a ``field``, containing details
like the field name, alias, type and expression.
.. versionadded:: 3.14
%End
void setFields( const QgsFields &fields );
%Docstring
Manually sets the ``fields`` to use for the model.
This method should only be used when the model ISN'T associated with a layer()
and needs to show the fields from an arbitrary field collection instead. Calling
setFields() will automatically clear any existing layer().
.. seealso:: :py:func:`fields`
.. versionadded:: 3.14
%End
QgsFields fields() const;
%Docstring
Returns the fields currently shown in the model.
This will either be fields from the associated layer() or the fields
manually set by a call to setFields().
.. versionadded:: 3.14
%End
public slots:
void setLayer( QgsVectorLayer *layer );
%Docstring
2017-12-15 10:36:55 -04:00
Set the layer from which fields are displayed.
.. seealso:: :py:func:`layer`
%End
protected slots:
virtual void updateModel();
%Docstring
2017-12-15 10:36:55 -04:00
Called when the model must be updated.
%End
protected:
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsfieldmodel.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/