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