QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Types | Public Slots | Public Member Functions | Protected Slots | Protected Attributes | List of all members
QgsFieldModel Class Reference

The QgsFieldModel class is a model to display the list of fields of a layer in widgets. More...

#include <qgsfieldmodel.h>

Inheritance diagram for QgsFieldModel:
Inheritance graph
[legend]

Public Types

enum  FieldRoles {
  FieldNameRole = Qt::UserRole + 1, FieldIndexRole = Qt::UserRole + 2, ExpressionRole = Qt::UserRole + 3, IsExpressionRole = Qt::UserRole + 4,
  ExpressionValidityRole = Qt::UserRole + 5, FieldTypeRole = Qt::UserRole + 6
}
 

Public Slots

void setLayer (QgsVectorLayer *layer)
 set the layer of whch fields are displayed More...
 

Public Member Functions

 QgsFieldModel (QObject *parent=0)
 QgsFieldModel creates a model to display the fields of a given layer. More...
 
QModelIndex indexFromName (const QString &fieldName)
 return the index corresponding to a given fieldName More...
 
void setAllowExpression (bool allowExpression)
 returns the currently used layer More...
 
bool allowExpression ()
 
bool isField (const QString &expression)
 
void setExpression (const QString &expression)
 setExpression sets a single expression to be added after the fields at the end of the model More...
 
void removeExpression ()
 remove expressions from the model More...
 
QgsVectorLayerlayer ()
 returns the currently used layer More...
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const
 
QModelIndex parent (const QModelIndex &child) const
 
int rowCount (const QModelIndex &parent=QModelIndex()) const
 
int columnCount (const QModelIndex &parent) const
 
QVariant data (const QModelIndex &index, int role) const
 

Protected Slots

virtual void updateModel ()
 

Protected Attributes

QgsFields mFields
 
QList< QString > mExpression
 
QgsVectorLayermLayer
 
bool mAllowExpression
 

Detailed Description

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.

Note
added in 2.3

Member Enumeration Documentation

Enumerator
FieldNameRole 
FieldIndexRole 
ExpressionRole 
IsExpressionRole 
ExpressionValidityRole 
FieldTypeRole 

Constructor & Destructor Documentation

QgsFieldModel::QgsFieldModel ( QObject *  parent = 0)
explicit

QgsFieldModel creates a model to display the fields of a given layer.

Member Function Documentation

bool QgsFieldModel::allowExpression ( )
inline
int QgsFieldModel::columnCount ( const QModelIndex &  parent) const
QVariant QgsFieldModel::data ( const QModelIndex &  index,
int  role 
) const
QModelIndex QgsFieldModel::index ( int  row,
int  column,
const QModelIndex &  parent = QModelIndex() 
) const
QModelIndex QgsFieldModel::indexFromName ( const QString &  fieldName)

return the index corresponding to a given fieldName

bool QgsFieldModel::isField ( const QString &  expression)
QgsVectorLayer* QgsFieldModel::layer ( )
inline

returns the currently used layer

QModelIndex QgsFieldModel::parent ( const QModelIndex &  child) const
void QgsFieldModel::removeExpression ( )

remove expressions from the model

int QgsFieldModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
void QgsFieldModel::setAllowExpression ( bool  allowExpression)

returns the currently used layer

void QgsFieldModel::setExpression ( const QString &  expression)

setExpression sets a single expression to be added after the fields at the end of the model

void QgsFieldModel::setLayer ( QgsVectorLayer layer)
slot

set the layer of whch fields are displayed

void QgsFieldModel::updateModel ( )
protectedvirtualslot

Member Data Documentation

bool QgsFieldModel::mAllowExpression
protected
QList<QString> QgsFieldModel::mExpression
protected
QgsFields QgsFieldModel::mFields
protected
QgsVectorLayer* QgsFieldModel::mLayer
protected

The documentation for this class was generated from the following files: