26 setModel( mFieldProxyModel );
73 QModelIndex proxyIdx = mFieldProxyModel->mapFromSource( idx );
74 if ( proxyIdx.isValid() )
76 setCurrentIndex( proxyIdx.row() );
80 setCurrentIndex( -1 );
85 setCurrentIndex( -1 );
94 int i = currentIndex();
96 const QModelIndex proxyIndex = mFieldProxyModel->index( i, 0 );
97 if ( !proxyIndex.isValid() )
Base class for all map layer types.
QgsFieldModel * sourceFieldModel()
Returns the QgsFieldModel used in this QSortFilterProxyModel.
QString currentField() const
Returns the currently selected field.
Container of fields for a vector layer.
QgsFieldProxyModel * setFilters(QgsFieldProxyModel::Filters filters)
Set flags that affect how fields are filtered in the model.
QgsFields fields() const
Returns the fields currently shown in the combobox.
void setFilters(QgsFieldProxyModel::Filters filters)
setFilters allows filtering according to the type of field
Return field name if index corresponds to a field.
void setFields(const QgsFields &fields)
Manually sets the fields to use for the model.
void setAllowEmptyFieldName(bool allowEmpty)
Sets whether an optional empty field ("not set") option is present in the model.
The QgsFieldProxyModel class provides an easy to use model to display the list of fields of a layer...
void setField(const QString &fieldName)
setField sets the currently selected field
QgsVectorLayer * layer() const
Returns the layer currently associated with the combobox.
void setLayer(QgsVectorLayer *layer)
Set the layer from which fields are displayed.
QgsFields fields() const
Returns the fields currently shown in the model.
void fieldChanged(const QString &fieldName)
Emitted when the currently selected field changes.
void setFields(const QgsFields &fields)
Manually sets the fields to use for the combo box.
QgsFieldProxyModel::Filters filters() const
currently used filter on list of fields
void setLayer(QgsMapLayer *layer)
Sets the layer for which fields are listed in the combobox.
void setAllowEmptyFieldName(bool allowEmpty)
Sets whether an optional empty field ("not set") option is shown in the combo box.
QgsFieldComboBox(QWidget *parent=nullptr)
QgsFieldComboBox creates a combo box to display the fields of a layer.
QModelIndex indexFromName(const QString &fieldName)
Returns the index corresponding to a given fieldName.
Represents a vector layer which manages a vector based data sets.
bool allowEmptyFieldName() const
Returns true if the combo box allows the empty field ("not set") choice.