21 : QSortFilterProxyModel( parent )
22 , mFilters( AllTypes )
25 setSourceModel( mModel );
35 bool QgsFieldProxyModel::isReadOnly(
const QModelIndex &index )
const 38 if ( originVariant.isNull() )
73 QModelIndex index = sourceModel()->index( source_row, 0, source_parent );
75 if ( mFilters.testFlag(
HideReadOnly ) && isReadOnly( index ) )
84 if ( typeVar.isNull() )
88 QVariant::Type type = ( QVariant::Type )typeVar.toInt( &ok );
92 if ( ( mFilters.testFlag(
String ) && type == QVariant::String ) ||
93 ( mFilters.testFlag(
LongLong ) && type == QVariant::LongLong ) ||
94 ( mFilters.testFlag(
Int ) && type == QVariant::Int ) ||
95 ( mFilters.testFlag(
Double ) && type == QVariant::Double ) ||
96 ( mFilters.testFlag(
Date ) && type == QVariant::Date ) ||
97 ( mFilters.testFlag(
Date ) && type == QVariant::DateTime ) ||
98 ( mFilters.testFlag(
DateTime ) && type == QVariant::DateTime ) ||
99 ( mFilters.testFlag(
Time ) && type == QVariant::Time ) )
123 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)
true if a joined field is editable (returns QVariant if not a joined field)
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