QgsFieldProxyModel class

The QgsFieldProxyModel class provides an easy to use model to display the list of fields of a layer.

Public types

enum Filter { String = 1, Int = 2, LongLong = 4, Double = 8, Numeric = Int | LongLong | Double, Date = 16, Time = 32, HideReadOnly = 64, AllTypes = Numeric | Date | String | Time }
Field type filters.

Constructors, destructors, conversion operators

QgsFieldProxyModel(QObject* parent = nullptr) explicit
QgsFieldProxModel creates a proxy model with a QgsFieldModel as source model.

Public functions

auto filters() const -> const Filters&
Returns the filters controlling displayed fields.
auto setFilters(QgsFieldProxyModel::Filters filters) -> QgsFieldProxyModel*
Set flags that affect how fields are filtered in the model.
auto sourceFieldModel() -> QgsFieldModel*
Returns the QgsFieldModel used in this QSortFilterProxyModel.

Enum documentation

enum QgsFieldProxyModel::Filter

Field type filters.

Enumerators
String

String fields.

Int

Integer fields.

LongLong

Longlong fields.

Double

Double fields.

Numeric

All numeric fields.

Date

Date or datetime fields.

Time

Time fields.

HideReadOnly

Hide read-only fields.

AllTypes

All field types.

Function documentation

QgsFieldProxyModel::QgsFieldProxyModel(QObject* parent = nullptr) explicit

QgsFieldProxModel creates a proxy model with a QgsFieldModel as source model.

It can be used to filter the fields based on their types.

const Filters& QgsFieldProxyModel::filters() const

Returns the filters controlling displayed fields.

QgsFieldProxyModel* QgsFieldProxyModel::setFilters(QgsFieldProxyModel::Filters filters)

Set flags that affect how fields are filtered in the model.

Parameters
filters are Filter flags