21   : QSortFilterProxyModel( parent )
 
   22   , mFilters( AllTypes )
 
   25   setSourceModel( mModel );
 
   35 bool QgsFieldProxyModel::isReadOnly( 
const QModelIndex &index )
 const 
   38   if ( originVariant.isNull() )
 
   83   QModelIndex index = sourceModel()->index( source_row, 0, source_parent );
 
   85   if ( mFilters.testFlag( 
HideReadOnly ) && isReadOnly( index ) )
 
   94   if ( typeVar.isNull() )
 
   98   QVariant::Type type = ( QVariant::Type )typeVar.toInt( &ok );
 
  102   if ( ( mFilters.testFlag( 
String ) && type == QVariant::String ) ||
 
  103        ( mFilters.testFlag( 
LongLong ) && type == QVariant::LongLong ) ||
 
  104        ( mFilters.testFlag( 
Int ) && type == QVariant::Int ) ||
 
  105        ( mFilters.testFlag( 
Double ) && type == QVariant::Double ) ||
 
  106        ( mFilters.testFlag( 
Date ) && type == QVariant::Date ) ||
 
  107        ( mFilters.testFlag( 
Date ) && type == QVariant::DateTime ) ||
 
  108        ( mFilters.testFlag( 
DateTime ) && type == QVariant::DateTime ) ||
 
  109        ( mFilters.testFlag( 
Time ) && type == QVariant::Time ) )
 
  133   return leftId < rightId;
 
The QgsFieldModel class is a model to display the list of fields in widgets (optionally associated wi...
@ FieldOriginRole
Return the field origin (if a field, returns QVariant if expression)
@ FieldIndexRole
Return field index if index corresponds to a field.
@ JoinedFieldIsEditable
true if a joined field is editable (returns QVariant if not a joined field)
@ FieldTypeRole
Return the field type (if a field, return QVariant if expression)
@ EditorWidgetType
Editor widget type.
@ IsEmptyRole
Return if the index corresponds to the empty value.
@ FieldIsWidgetEditable
true if a is editable from the widget
The QgsFieldProxyModel class provides an easy to use model to display the list of fields of a layer.
const Filters & filters() const
Returns the filters controlling displayed fields.
@ DateTime
Datetime fieldss.
@ HideReadOnly
Hide read-only fields.
@ LongLong
Longlong fields.
@ AllTypes
All field types.
@ Date
Date or datetime 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.
@ OriginExpression
Field is calculated from an expression.
@ OriginEdit
Field has been temporarily added in editing mode (originIndex = index in the list of added attributes...
@ OriginUnknown
It has not been specified where the field comes from.
@ OriginJoin
Field comes from a joined layer (originIndex / 1000 = index of the join, originIndex % 1000 = index w...
@ OriginProvider
Field comes from the underlying data provider of the vector layer (originIndex = index in provider's ...