QGIS API Documentation  2.4.0-Chugiak
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Slots | Signals | Public Member Functions | Protected Slots | Properties | Private Attributes | List of all members
QgsFieldComboBox Class Reference

The QgsFieldComboBox is a combo box which displays the list of fields of a given layer. More...

#include <qgsfieldcombobox.h>

Inheritance diagram for QgsFieldComboBox:
Inheritance graph
[legend]
Collaboration diagram for QgsFieldComboBox:
Collaboration graph
[legend]

Public Slots

void setLayer (QgsVectorLayer *layer)
 set the layer of which the fields are listed More...
 
void setLayer (QgsMapLayer *layer)
 convenience slot to connect QgsMapLayerComboBox layer signal More...
 
void setField (QString fieldName)
 setField sets the currently selected field More...
 

Signals

void fieldChanged (QString fieldName)
 the signal is emitted when the currently selected field changes More...
 

Public Member Functions

 QgsFieldComboBox (QWidget *parent=0)
 QgsFieldComboBox creates a combo box to display the fields of a layer. More...
 
void setFilters (QgsFieldProxyModel::Filters filters)
 setFilters allows fitering according to the type of field More...
 
QgsFieldProxyModel::Filters filters ()
 currently used filter on list of fields More...
 
QString currentField ()
 return the currently selected field More...
 
QgsVectorLayerlayer ()
 Returns the currently used layer. More...
 

Protected Slots

void indexChanged (int i)
 

Properties

QgsFieldProxyModel::Filters filters
 

Private Attributes

QgsFieldProxyModelmFieldProxyModel
 

Detailed Description

The QgsFieldComboBox is a combo box which displays the list of fields of a given layer.

It might be combined with a QgsMapLayerComboBox to automatically update fields according to a chosen layer. If expression must be used, QgsFieldExpressionWidget shall be used instead.

See also
QgsMapLayerComboBox
Note
added in 2.3

Definition at line 33 of file qgsfieldcombobox.h.

Constructor & Destructor Documentation

QgsFieldComboBox::QgsFieldComboBox ( QWidget *  parent = 0)
explicit

QgsFieldComboBox creates a combo box to display the fields of a layer.

The layer can be either manually given or dynamically set by connecting the signal QgsMapLayerComboBox::layerChanged to the slot setLayer.

Definition at line 21 of file qgsfieldcombobox.cpp.

References indexChanged(), and mFieldProxyModel.

Member Function Documentation

QString QgsFieldComboBox::currentField ( )

return the currently selected field

Definition at line 70 of file qgsfieldcombobox.cpp.

References QgsFieldModel::FieldNameRole, and mFieldProxyModel.

Referenced by indexChanged(), and setField().

void QgsFieldComboBox::fieldChanged ( QString  fieldName)
signal

the signal is emitted when the currently selected field changes

Referenced by indexChanged(), and setField().

QgsFieldProxyModel::Filters QgsFieldComboBox::filters ( )
inline

currently used filter on list of fields

Definition at line 50 of file qgsfieldcombobox.h.

References QgsFieldProxyModel::filters().

void QgsFieldComboBox::indexChanged ( int  i)
protectedslot

Definition at line 84 of file qgsfieldcombobox.cpp.

References currentField(), and fieldChanged().

Referenced by QgsFieldComboBox().

QgsVectorLayer * QgsFieldComboBox::layer ( )

Returns the currently used layer.

Definition at line 49 of file qgsfieldcombobox.cpp.

References QgsFieldModel::layer(), mFieldProxyModel, and QgsFieldProxyModel::sourceFieldModel().

Referenced by setLayer().

void QgsFieldComboBox::setField ( QString  fieldName)
slot

setField sets the currently selected field

Definition at line 54 of file qgsfieldcombobox.cpp.

References currentField(), fieldChanged(), QgsFieldModel::indexFromName(), mFieldProxyModel, and QgsFieldProxyModel::sourceFieldModel().

void QgsFieldComboBox::setFilters ( QgsFieldProxyModel::Filters  filters)

setFilters allows fitering according to the type of field

Definition at line 30 of file qgsfieldcombobox.cpp.

References mFieldProxyModel, and QgsFieldProxyModel::setFilters().

void QgsFieldComboBox::setLayer ( QgsVectorLayer layer)
slot

set the layer of which the fields are listed

Definition at line 44 of file qgsfieldcombobox.cpp.

References mFieldProxyModel, QgsFieldModel::setLayer(), and QgsFieldProxyModel::sourceFieldModel().

Referenced by setLayer().

void QgsFieldComboBox::setLayer ( QgsMapLayer layer)
slot

convenience slot to connect QgsMapLayerComboBox layer signal

Definition at line 35 of file qgsfieldcombobox.cpp.

References layer(), and setLayer().

Member Data Documentation

QgsFieldProxyModel* QgsFieldComboBox::mFieldProxyModel
private

Definition at line 76 of file qgsfieldcombobox.h.

Referenced by currentField(), layer(), QgsFieldComboBox(), setField(), setFilters(), and setLayer().

Property Documentation

QgsFieldProxyModel::Filters QgsFieldComboBox::filters
readwrite

Definition at line 37 of file qgsfieldcombobox.h.


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