21#include "moc_qgsfieldproxymodel.cpp"
24 : QSortFilterProxyModel( parent )
28 setSourceModel( mModel );
38bool QgsFieldProxyModel::isReadOnly(
const QModelIndex &index )
const
86 const QModelIndex index = sourceModel()->index( source_row, 0, source_parent );
88 if ( mFilters.testFlag(
HideReadOnly ) && isReadOnly( index ) )
107 if ( mFilters.testFlag(
AllTypes ) )
117 const QMetaType::Type type =
static_cast<QMetaType::Type
>( typeVar.toInt( &ok ) );
121 if ( ( mFilters.testFlag(
String ) && type == QMetaType::Type::QString ) ||
122 ( mFilters.testFlag(
LongLong ) && type == QMetaType::Type::LongLong ) ||
123 ( mFilters.testFlag(
Int ) && type == QMetaType::Type::Int ) ||
124 ( mFilters.testFlag(
Double ) && type == QMetaType::Type::Double ) ||
125 ( mFilters.testFlag(
Date ) && type == QMetaType::Type::QDate ) ||
126 ( mFilters.testFlag(
Date ) && type == QMetaType::Type::QDateTime ) ||
127 ( mFilters.testFlag(
DateTime ) && type == QMetaType::Type::QDateTime ) ||
128 ( mFilters.testFlag(
Time ) && type == QMetaType::Type::QTime ) ||
129 ( mFilters.testFlag(
Binary ) && type == QMetaType::Type::QByteArray ) ||
130 ( mFilters.testFlag(
Boolean ) && type == QMetaType::Type::Bool ) )
154 return leftId < rightId;
@ Provider
Field originates from the underlying data provider of the vector layer.
@ Edit
Field has been temporarily added in editing mode.
@ Unknown
The field origin has not been specified.
@ Expression
Field is calculated from an expression.
@ Join
Field originates from a joined layer.
A model which displays the list of fields in widgets (optionally associated with a vector layer).
@ FieldIsWidgetEditable
true if a is editable from the widget
@ FieldOrigin
Return the field origin (if a field, returns QVariant if expression).
@ IsEmpty
Return if the index corresponds to the empty value.
@ FieldIndex
Return field index if index corresponds to a field.
@ EditorWidgetType
Editor widget type.
@ FieldType
Return the field type (if a field, return QVariant if expression).
@ JoinedFieldIsEditable
true if a joined field is editable (returns QVariant if not a joined field)
@ DateTime
Datetime fields.
@ HideReadOnly
Hide read-only fields.
@ LongLong
Longlong fields.
@ AllTypes
All field types.
@ Date
Date or datetime fields.
@ Binary
Binary fields, since QGIS 3.34.
@ Boolean
Boolean fields, since QGIS 3.34.
@ OriginProvider
Fields with a provider origin, since QGIS 3.38.
const Filters & filters() const
Returns the filters controlling displayed fields.
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override
QgsFieldProxyModel(QObject *parent=nullptr)
QgsFieldProxModel creates a proxy model with a QgsFieldModel as source model.
QgsFieldProxyModel * setFilters(QgsFieldProxyModel::Filters filters)
Set flags that affect how fields are filtered in the model.
static bool isNull(const QVariant &variant, bool silenceNullWarnings=false)
Returns true if the specified variant should be considered a NULL value.