21 : QSortFilterProxyModel( parent )
22 , mFilters( AllTypes )
25 setSourceModel( mModel );
35 bool QgsFieldProxyModel::isReadOnly(
const QModelIndex &index )
const 38 if ( originVariant.isNull() )
63 QModelIndex index = sourceModel()->index( source_row, 0, source_parent );
65 if ( mFilters.testFlag(
HideReadOnly ) && isReadOnly( index ) )
74 if ( typeVar.isNull() )
78 QVariant::Type type = ( QVariant::Type )typeVar.toInt( &ok );
82 if ( ( mFilters.testFlag(
String ) && type == QVariant::String ) ||
83 ( mFilters.testFlag(
LongLong ) && type == QVariant::LongLong ) ||
84 ( mFilters.testFlag(
Int ) && type == QVariant::Int ) ||
85 ( mFilters.testFlag(
Double ) && type == QVariant::Double ) ||
86 ( mFilters.testFlag(
Date ) && type == QVariant::Date ) ||
87 ( mFilters.testFlag(
Date ) && type == QVariant::DateTime ) ||
88 ( mFilters.testFlag(
Time ) && type == QVariant::Time ) )
112 return leftId < rightId;
Field comes from a joined layer (originIndex / 1000 = index of the join, originIndex % 1000 = index w...
Field has been temporarily added in editing mode (originIndex = index in the list of added attributes...
Return field index if index corresponds to a field.
QgsFieldProxyModel * setFilters(QgsFieldProxyModel::Filters filters)
Set flags that affect how fields are filtered in the model.
The QgsFieldModel class is a model to display the list of fields of a layer in widgets.
Field comes from the underlying data provider of the vector layer (originIndex = index in provider's ...
Return the field origin (if a field, returns QVariant if expression)
It has not been specified where the field comes from.
The QgsFieldProxyModel class provides an easy to use model to display the list of fields of a layer...
QgsFieldProxyModel(QObject *parent=nullptr)
QgsFieldProxModel creates a proxy model with a QgsFieldModel as source model.
Return the field type (if a field, return QVariant if expression)
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override
const Filters & filters() const
Returns the filters controlling displayed fields.
Return if the index corresponds to the empty value.
Field is calculated from an expression.
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override