Skip to content
Permalink
Browse files
move QgsFieldModel and QgsFieldProxyModel to core and sipify
  • Loading branch information
3nids committed Apr 19, 2017
1 parent bd4f712 commit 0b0e8a6a891c9c85a622a38a83d795d59f3fa53c
@@ -361,8 +361,6 @@ gui/qgsexpressionlineedit.sip
gui/qgsexpressionselectiondialog.sip
gui/qgsextentgroupbox.sip
gui/qgsfeatureselectiondlg.sip
gui/qgsfieldmodel.sip
gui/qgsfieldproxymodel.sip
gui/qgsfieldvalidator.sip
gui/qgsfieldvalueslineedit.sip
gui/qgsfiledropedit.sip
@@ -74,6 +74,8 @@
%Include qgstransactiongroup.sip
%Include qgsdartmeasurement.sip
%Include qgsexpressionfieldbuffer.sip
%Include qgsfieldmodel.sip
%Include qgsfieldproxymodel.sip
%Include qgsfontutils.sip
%Include qgslabelsearchtree.sip
%Include qgslegendrenderer.sip
@@ -0,0 +1,145 @@
/************************************************************************
* 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.
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
{
FieldNameRole
FieldIndexRole
ExpressionRole
IsExpressionRole
ExpressionValidityRole
FieldTypeRole
FieldOriginRole
IsEmptyRole
};

explicit QgsFieldModel( QObject *parent /TransferThis/ = 0 );
%Docstring
Constructor for QgsFieldModel - creates a model to display the fields of a given layer.
%End

QModelIndex indexFromName( const QString &fieldName );
%Docstring
Returns the index corresponding to a given fieldName.
:rtype: QModelIndex
%End

void setAllowExpression( bool allowExpression );
%Docstring
Sets whether custom expressions are accepted and displayed in the model.
\see allowExpression()
\see setExpression()
%End

bool allowExpression();
%Docstring
Returns true if the model allows custom expressions to be created and displayed.
\see setAllowExpression()
:rtype: bool
%End

void setAllowEmptyFieldName( bool allowEmpty );
%Docstring
Sets whether an optional empty field ("not set") option is present in the model.
\see allowEmptyFieldName()
.. versionadded:: 3.0
%End

bool allowEmptyFieldName() const;
%Docstring
Returns true if the model allows the empty field ("not set") choice.
\see setAllowEmptyFieldName()
.. versionadded:: 3.0
:rtype: bool
%End

bool isField( const QString &expression ) const;
%Docstring
Returns true if a string represents a field reference, or false if it is an
expression consisting of more than direct field reference.
:rtype: bool
%End

void setExpression( const QString &expression );
%Docstring
Sets a single expression to be added after the fields at the end of the model.
\see setAllowExpression()
\see allowExpression()
\see removeExpression()
%End

void removeExpression();
%Docstring
Removes any custom expression from the model.
\see setExpression()
\see allowExpression()
%End

QgsVectorLayer *layer();
%Docstring
Returns the layer associated with the model.
\see setLayer()
:rtype: QgsVectorLayer
%End

virtual QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const;
%Docstring
QAbstractItemModel interface
:rtype: QModelIndex
%End
virtual QModelIndex parent( const QModelIndex &child ) const;
virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const;
virtual int columnCount( const QModelIndex &parent ) const;
virtual QVariant data( const QModelIndex &index, int role ) const;

public slots:

void setLayer( QgsVectorLayer *layer );
%Docstring
Set the layer from which fields are displayed.
\see layer()
%End

protected slots:

virtual void updateModel();
%Docstring
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 *
************************************************************************/
@@ -0,0 +1,80 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsfieldproxymodel.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/






class QgsFieldProxyModel : QSortFilterProxyModel
{
%Docstring
The QgsFieldProxyModel class provides an easy to use model to display the list of fields of a layer.
.. versionadded:: 2.3
%End

%TypeHeaderCode
#include "qgsfieldproxymodel.h"
%End
public:

enum Filter
{
String,
Int,
LongLong,
Double,
Numeric
Date,
Time,
HideReadOnly,
AllTypes
};
typedef QFlags<QgsFieldProxyModel::Filter> Filters;

explicit QgsFieldProxyModel( QObject *parent /TransferThis/ = 0 );
%Docstring
QgsFieldProxModel creates a proxy model with a QgsFieldModel as source model.
It can be used to filter the fields based on their types.
%End

QgsFieldModel *sourceFieldModel();
%Docstring
Returns the QgsFieldModel used in this QSortFilterProxyModel
:rtype: QgsFieldModel
%End

QgsFieldProxyModel *setFilters( QgsFieldProxyModel::Filters filters );
%Docstring
Set flags that affect how fields are filtered in the model.
\param filters are Filter flags
\see filters()
:rtype: QgsFieldProxyModel
%End

const Filters &filters() const;
%Docstring
Returns the filters controlling displayed fields.
\see setFilters()
:rtype: Filters
%End

public:
virtual bool filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const;
virtual bool lessThan( const QModelIndex &left, const QModelIndex &right ) const;
};

QFlags<QgsFieldProxyModel::Filter> operator|(QgsFieldProxyModel::Filter f1, QFlags<QgsFieldProxyModel::Filter> f2);

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsfieldproxymodel.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -72,8 +72,6 @@
%Include qgsfeatureselectiondlg.sip
%Include qgsfieldcombobox.sip
%Include qgsfieldexpressionwidget.sip
%Include qgsfieldmodel.sip
%Include qgsfieldproxymodel.sip
%Include qgsfieldvalidator.sip
%Include qgsfieldvalueslineedit.sip
%Include qgsfiledropedit.sip

This file was deleted.

Loading

0 comments on commit 0b0e8a6

Please sign in to comment.