QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
Classes | Public Types | Public Member Functions | List of all members
QgsAggregateMappingModel Class Reference

The QgsAggregateMappingModel holds mapping information for defining sets of aggregates of fields from a QgsFields object. More...

#include <qgsprocessingaggregatewidgets.h>

Inheritance diagram for QgsAggregateMappingModel:
Inheritance graph
[legend]

Classes

struct  Aggregate
 The Aggregate struct holds information about an aggregate column. More...
 

Public Types

enum  ColumnDataIndex : int {
  ColumnDataIndex::SourceExpression, ColumnDataIndex::Aggregate, ColumnDataIndex::Delimiter, ColumnDataIndex::DestinationName,
  ColumnDataIndex::DestinationType, ColumnDataIndex::DestinationLength, ColumnDataIndex::DestinationPrecision
}
 The ColumnDataIndex enum represents the column index for the view. More...
 

Public Member Functions

 QgsAggregateMappingModel (const QgsFields &sourceFields=QgsFields(), QObject *parent=nullptr)
 Constructs a QgsAggregateMappingModel from a set of sourceFields. More...
 
void appendField (const QgsField &field, const QString &source=QString(), const QString &aggregate=QString())
 Appends a new field to the model, with an optional source and aggregate. More...
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
QgsExpressionContextGeneratorcontextGenerator () const
 Returns the context generator with the source fields. More...
 
QVariant data (const QModelIndex &index, int role) const override
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 
QVariant headerData (int section, Qt::Orientation orientation, int role) const override
 
QList< QgsAggregateMappingModel::Aggregatemapping () const
 Returns a list of Aggregate objects representing the current status of the model. More...
 
bool moveDown (const QModelIndex &index)
 Moves up the field at index. More...
 
bool moveUp (const QModelIndex &index)
 Moves down the field at index. More...
 
 Q_ENUM (ColumnDataIndex)
 
bool removeField (const QModelIndex &index)
 Removes the field at index from the model, returns true on success. More...
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
void setBaseExpressionContextGenerator (const QgsExpressionContextGenerator *generator)
 Sets the base expression context generator, which will generate the expression contexts for expression based widgets used by the model. More...
 
bool setData (const QModelIndex &index, const QVariant &value, int role) override
 
void setMapping (const QList< QgsAggregateMappingModel::Aggregate > &mapping)
 Sets the mapping to show in the model. More...
 
void setSourceFields (const QgsFields &sourceFields)
 Set source fields to sourceFields. More...
 
QgsFields sourceFields () const
 Returns a list of source fields. More...
 

Detailed Description

The QgsAggregateMappingModel holds mapping information for defining sets of aggregates of fields from a QgsFields object.

Since
QGIS 3.14

Definition at line 41 of file qgsprocessingaggregatewidgets.h.

Member Enumeration Documentation

◆ ColumnDataIndex

The ColumnDataIndex enum represents the column index for the view.

Enumerator
SourceExpression 

Expression.

Aggregate 

Aggregate name.

Delimiter 

Delimiter.

DestinationName 

Destination field name.

DestinationType 

Destination field QVariant::Type casted to (int)

DestinationLength 

Destination field length.

DestinationPrecision 

Destination field precision.

Definition at line 51 of file qgsprocessingaggregatewidgets.h.

Constructor & Destructor Documentation

◆ QgsAggregateMappingModel()

QgsAggregateMappingModel::QgsAggregateMappingModel ( const QgsFields sourceFields = QgsFields(),
QObject *  parent = nullptr 
)

Constructs a QgsAggregateMappingModel from a set of sourceFields.

A parent object can be also specified.

Definition at line 34 of file qgsprocessingaggregatewidgets.cpp.

Member Function Documentation

◆ appendField()

void QgsAggregateMappingModel::appendField ( const QgsField field,
const QString &  source = QString(),
const QString &  aggregate = QString() 
)

Appends a new field to the model, with an optional source and aggregate.

Definition at line 307 of file qgsprocessingaggregatewidgets.cpp.

◆ columnCount()

int QgsAggregateMappingModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const
override

Definition at line 104 of file qgsprocessingaggregatewidgets.cpp.

◆ contextGenerator()

QgsExpressionContextGenerator * QgsAggregateMappingModel::contextGenerator ( ) const

Returns the context generator with the source fields.

Definition at line 285 of file qgsprocessingaggregatewidgets.cpp.

◆ data()

QVariant QgsAggregateMappingModel::data ( const QModelIndex &  index,
int  role 
) const
override

Definition at line 111 of file qgsprocessingaggregatewidgets.cpp.

◆ flags()

Qt::ItemFlags QgsAggregateMappingModel::flags ( const QModelIndex &  index) const
override

Definition at line 161 of file qgsprocessingaggregatewidgets.cpp.

◆ headerData()

QVariant QgsAggregateMappingModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role 
) const
override

Definition at line 42 of file qgsprocessingaggregatewidgets.cpp.

◆ mapping()

QList< QgsAggregateMappingModel::Aggregate > QgsAggregateMappingModel::mapping ( ) const

Returns a list of Aggregate objects representing the current status of the model.

Definition at line 295 of file qgsprocessingaggregatewidgets.cpp.

◆ moveDown()

bool QgsAggregateMappingModel::moveDown ( const QModelIndex &  index)

Moves up the field at index.

Definition at line 340 of file qgsprocessingaggregatewidgets.cpp.

◆ moveUp()

bool QgsAggregateMappingModel::moveUp ( const QModelIndex &  index)

Moves down the field at index.

Definition at line 335 of file qgsprocessingaggregatewidgets.cpp.

◆ Q_ENUM()

QgsAggregateMappingModel::Q_ENUM ( ColumnDataIndex  )

◆ removeField()

bool QgsAggregateMappingModel::removeField ( const QModelIndex &  index)

Removes the field at index from the model, returns true on success.

Definition at line 320 of file qgsprocessingaggregatewidgets.cpp.

◆ rowCount()

int QgsAggregateMappingModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
override

Definition at line 97 of file qgsprocessingaggregatewidgets.cpp.

◆ setBaseExpressionContextGenerator()

void QgsAggregateMappingModel::setBaseExpressionContextGenerator ( const QgsExpressionContextGenerator generator)

Sets the base expression context generator, which will generate the expression contexts for expression based widgets used by the model.

Definition at line 290 of file qgsprocessingaggregatewidgets.cpp.

◆ setData()

bool QgsAggregateMappingModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role 
)
override

Definition at line 172 of file qgsprocessingaggregatewidgets.cpp.

◆ setMapping()

void QgsAggregateMappingModel::setMapping ( const QList< QgsAggregateMappingModel::Aggregate > &  mapping)

Sets the mapping to show in the model.

Definition at line 300 of file qgsprocessingaggregatewidgets.cpp.

◆ setSourceFields()

void QgsAggregateMappingModel::setSourceFields ( const QgsFields sourceFields)

Set source fields to sourceFields.

Definition at line 257 of file qgsprocessingaggregatewidgets.cpp.

◆ sourceFields()

QgsFields QgsAggregateMappingModel::sourceFields ( ) const

Returns a list of source fields.

Definition at line 92 of file qgsprocessingaggregatewidgets.cpp.


The documentation for this class was generated from the following files: