26 setModel( mFieldProxyModel );
62 QModelIndex proxyIdx = mFieldProxyModel->mapFromSource( idx );
63 if ( proxyIdx.isValid() )
65 setCurrentIndex( proxyIdx.row() );
70 setCurrentIndex( -1 );
75 int i = currentIndex();
77 const QModelIndex proxyIndex = mFieldProxyModel->index( i, 0 );
78 if ( !proxyIndex.isValid() )
80 return QLatin1String(
"" );
Base class for all map layer types.
QgsFieldModel * sourceFieldModel()
Returns the QgsFieldModel used in this QSortFilterProxyModel.
QString currentField() const
return the currently selected field
QgsFieldProxyModel * setFilters(QgsFieldProxyModel::Filters filters)
Set flags that affect how fields are filtered in the model.
void setFilters(QgsFieldProxyModel::Filters filters)
setFilters allows fitering according to the type of field
Return field name if index corresponds to a field.
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.
void fieldChanged(const QString &fieldName)
the signal is emitted when the currently selected field changes
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.