17#include "moc_qgsfieldproxymodel.cpp" 
   22  : QSortFilterProxyModel( parent )
 
   23  , mFilters( AllTypes )
 
   26  setSourceModel( mModel );
 
 
   36bool QgsFieldProxyModel::isReadOnly( 
const QModelIndex &index )
 const 
   84  const QModelIndex index = sourceModel()->index( source_row, 0, source_parent );
 
   86  if ( mFilters.testFlag( 
HideReadOnly ) && isReadOnly( index ) )
 
  105  if ( mFilters.testFlag( 
AllTypes ) )
 
  115  const QMetaType::Type type = 
static_cast<QMetaType::Type
>( typeVar.toInt( &ok ) );
 
  119  if ( ( mFilters.testFlag( 
String ) && type == QMetaType::Type::QString ) ||
 
  120       ( mFilters.testFlag( 
LongLong ) && type == QMetaType::Type::LongLong ) ||
 
  121       ( mFilters.testFlag( 
Int ) && type == QMetaType::Type::Int ) ||
 
  122       ( mFilters.testFlag( 
Double ) && type == QMetaType::Type::Double ) ||
 
  123       ( mFilters.testFlag( 
Date ) && type == QMetaType::Type::QDate ) ||
 
  124       ( mFilters.testFlag( 
Date ) && type == QMetaType::Type::QDateTime ) ||
 
  125       ( mFilters.testFlag( 
DateTime ) && type == QMetaType::Type::QDateTime ) ||
 
  126       ( mFilters.testFlag( 
Time ) && type == QMetaType::Type::QTime ) ||
 
  127       ( mFilters.testFlag( 
Binary ) && type == QMetaType::Type::QByteArray ) ||
 
  128       ( mFilters.testFlag( 
Boolean ) && type == QMetaType::Type::Bool ) )
 
 
  152  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)
 
A proxy model to filter the list of fields of a layer.
 
@ 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.