QGIS/python/core/qgsfieldmodel.sip

157 lines
4.1 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
The QgsFieldModel class is a model to display the list of fields of a layer in widgets.
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,
};
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.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`allowExpression()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setExpression()`
%End
bool allowExpression();
%Docstring
2017-12-15 10:36:55 -04:00
Returns true if the model allows custom expressions to be created and displayed.
2017-12-05 20:04:14 -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.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`allowEmptyFieldName()`
2017-12-15 10:36:55 -04:00
.. versionadded:: 3.0
%End
bool allowEmptyFieldName() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns true if the model allows the empty field ("not set") choice.
2017-12-05 20:04:14 -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
2017-12-15 10:36:55 -04:00
Returns true if a string represents a field reference, or false if it is an
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.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setAllowExpression()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`allowExpression()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -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.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setExpression()`
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -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.
2017-12-05 20:04:14 -04:00
.. 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
public slots:
void setLayer( QgsVectorLayer *layer );
%Docstring
2017-12-15 10:36:55 -04:00
Set the layer from which fields are displayed.
2017-12-05 20:04:14 -04:00
.. 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 *
************************************************************************/