QGIS API Documentation  2.99.0-Master (37c43df)
Public Slots | Signals | Public Member Functions | Protected Slots | Properties | 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]

Public Slots

void setField (const QString &fieldName)
 setField sets the currently selected field More...
 
void setLayer (QgsMapLayer *layer)
 Sets the layer for which fields are listed in the combobox. More...
 

Signals

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

Public Member Functions

 QgsFieldComboBox (QWidget *parent=nullptr)
 QgsFieldComboBox creates a combo box to display the fields of a layer. More...
 
bool allowEmptyFieldName () const
 Returns true if the combo box allows the empty field ("not set") choice. More...
 
QString currentField () const
 return the currently selected field More...
 
QgsFieldProxyModel::Filters filters () const
 currently used filter on list of fields More...
 
QgsVectorLayerlayer () const
 Returns the layer currently associated with the combobox. More...
 
void setAllowEmptyFieldName (bool allowEmpty)
 Sets whether an optional empty field ("not set") option is shown in the combo box. More...
 
void setFilters (QgsFieldProxyModel::Filters filters)
 setFilters allows fitering according to the type of field More...
 

Protected Slots

void indexChanged (int i)
 

Properties

bool allowEmptyFieldName
 
QgsFieldProxyModel::Filters filters
 

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::QgsFieldComboBox ( QWidget *  parent = nullptr)
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 22 of file qgsfieldcombobox.cpp.

Member Function Documentation

§ allowEmptyFieldName()

bool QgsFieldComboBox::allowEmptyFieldName ( ) const

Returns true if the combo box allows the empty field ("not set") choice.

See also
setAllowEmptyFieldName()
Note
added in QGIS 3.0

§ currentField()

QString QgsFieldComboBox::currentField ( ) const

return the currently selected field

Definition at line 73 of file qgsfieldcombobox.cpp.

§ fieldChanged

void QgsFieldComboBox::fieldChanged ( const QString &  fieldName)
signal

the signal is emitted when the currently selected field changes

§ filters()

QgsFieldProxyModel::Filters QgsFieldComboBox::filters ( ) const
inline

currently used filter on list of fields

Definition at line 52 of file qgsfieldcombobox.h.

§ indexChanged

void QgsFieldComboBox::indexChanged ( int  i)
protectedslot

Definition at line 87 of file qgsfieldcombobox.cpp.

§ layer()

QgsVectorLayer * QgsFieldComboBox::layer ( ) const

Returns the layer currently associated with the combobox.

See also
setLayer()

Definition at line 52 of file qgsfieldcombobox.cpp.

§ setAllowEmptyFieldName()

void QgsFieldComboBox::setAllowEmptyFieldName ( bool  allowEmpty)

Sets whether an optional empty field ("not set") option is shown in the combo box.

See also
allowEmptyFieldName()
Note
added in QGIS 3.0

Definition at line 36 of file qgsfieldcombobox.cpp.

§ setField

void QgsFieldComboBox::setField ( const QString &  fieldName)
slot

setField sets the currently selected field

Definition at line 57 of file qgsfieldcombobox.cpp.

§ setFilters()

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

setFilters allows fitering according to the type of field

Definition at line 31 of file qgsfieldcombobox.cpp.

§ setLayer

void QgsFieldComboBox::setLayer ( QgsMapLayer layer)
slot

Sets the layer for which fields are listed in the combobox.

If no layer is set or a non-vector layer is set then the combobox will be empty.

See also
layer()

Definition at line 46 of file qgsfieldcombobox.cpp.

Property Documentation

§ allowEmptyFieldName

bool QgsFieldComboBox::allowEmptyFieldName
readwrite

Definition at line 38 of file qgsfieldcombobox.h.

§ filters

QgsFieldProxyModel::Filters QgsFieldComboBox::filters
readwrite

Definition at line 37 of file qgsfieldcombobox.h.


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