|
QGIS API Documentation 4.1.0-Master (009143bf4b4)
|
Manages form layouts when configuring attributes forms via drag and drop designer. More...
#include <qgsattributesformmodel.h>

Public Slots | |
| void | populate () override |
| Public Slots inherited from QgsAttributesFormModel | |
| virtual void | populate ()=0 |
| Populates the model with initial data read from the layer. | |
Signals | |
| void | externalItemDropped (QModelIndex &index) |
| Informs that items were inserted (via drop) in the model from another model. | |
| void | internalItemDropped (QModelIndex &index) |
| Informs that items were moved (via drop) in the model from the same model. | |
| Signals inherited from QgsAttributesFormModel | |
| void | fieldConfigDataChanged (QgsAttributesFormItem *item) |
| Notifies other objects that the field config data has changed in the item. | |
Public Member Functions | |
| QgsAttributesFormLayoutModel (QgsVectorLayer *layer, QgsProject *project, QObject *parent=nullptr) | |
| Constructor for QgsAttributesFormLayoutModel, with the given parent. | |
| void | addContainer (QModelIndex &parent, const QString &name, int columnCount, Qgis::AttributeEditorContainerType type) |
| Adds a new container to parent. | |
| QgsAttributeEditorElement * | createAttributeEditorWidget (const QModelIndex &index, QgsAttributeEditorElement *parent) const |
| Creates a new attribute editor element based on the definition stored in a form layout model index. | |
| QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
| bool | dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override |
| Qt::ItemFlags | flags (const QModelIndex &index) const override |
| QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override |
| void | insertChild (const QModelIndex &parent, int row, const QString &itemId, QgsAttributesFormData::AttributesFormItemType itemType, const QString &itemName) |
| Inserts a new child to parent model index at the given row position. | |
| QList< QgsAddAttributeFormContainerDialog::ContainerPair > | listOfContainers () const |
| Returns a list of containers stored in the model, structured as pairs (name, container model index). | |
| QMimeData * | mimeData (const QModelIndexList &indexes) const override |
| QStringList | mimeTypes () const override |
| bool | removeRow (int row, const QModelIndex &parent=QModelIndex()) |
| Removes the index located at row within the given parent. | |
| bool | removeRows (int row, int count, const QModelIndex &parent=QModelIndex()) override |
| Qt::DropActions | supportedDragActions () const override |
| Qt::DropActions | supportedDropActions () const override |
| void | updateAliasForFieldItems (const QString &fieldName, const QString &fieldAlias) |
| Updates the aliases of all matching fields in the model. | |
| void | updateFieldConfigForFieldItems (const QString &fieldName, const QgsAttributesFormData::FieldConfig &config) |
| Updates the field config of all matching fields in the model. | |
| Public Member Functions inherited from QgsAttributesFormModel | |
| QgsAttributesFormModel (QgsVectorLayer *layer, QgsProject *project, QObject *parent=nullptr) | |
| Constructor for QgsAttributesFormModel, with the given parent. | |
| ~QgsAttributesFormModel () override | |
| int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
| QModelIndex | firstRecursiveMatchingModelIndex (const QgsAttributesFormData::AttributesFormItemType &itemType, const QString &itemId) const |
| Returns the first model index that matches the given itemType and itemId, recursively. | |
| QModelIndex | firstTopMatchingModelIndex (const QgsAttributesFormData::AttributesFormItemType &itemType, const QString &itemId) const |
| Returns the first top-level model index that matches the given itemType and itemId. | |
| QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const override |
| QgsAttributesFormItem * | itemForIndex (const QModelIndex &index) const |
| Returns the underlying item that corresponds to the given index. | |
| QModelIndex | parent (const QModelIndex &index) const override |
| QgsAttributesFormItem * | rootItem () const |
| Returns the root item in this model. | |
| int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
| bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override |
| void | setShowAliases (bool show) |
| Sets whether field aliases should be preferred over field names as item text. | |
| bool | showAliases () const |
| Returns whether field aliases are preferred over field names as item text. | |
Additional Inherited Members | |
| Public Types inherited from QgsAttributesFormModel | |
| enum | ItemRoles { ItemDataRole = Qt::UserRole , ItemFieldConfigRole , ItemNameRole , ItemIdRole , ItemTypeRole , ItemDisplayRole } |
| Custom model roles. More... | |
| Protected Member Functions inherited from QgsAttributesFormModel | |
| void | emitDataChangedRecursively (const QModelIndex &parent=QModelIndex(), const QVector< int > &roles=QVector< int >()) |
| Emits dataChanged signal for all parent items in a model. | |
| bool | indexLessThan (const QModelIndex &a, const QModelIndex &b) const |
| Auxiliary function to sort indexes, returning true if index a is less than index b. | |
| QVector< int > | rootToLeafPath (QgsAttributesFormItem *item) const |
| Returns a QVector of iterative positions from root item to the given item. | |
| Protected Attributes inherited from QgsAttributesFormModel | |
| QgsVectorLayer * | mLayer |
| QgsProject * | mProject |
| std::unique_ptr< QgsAttributesFormItem > | mRootItem |
| bool | mShowAliases = false |
Manages form layouts when configuring attributes forms via drag and drop designer.
Definition at line 775 of file qgsattributesformmodel.h.
|
explicit |
Constructor for QgsAttributesFormLayoutModel, with the given parent.
The given layer is the data source to populate the model. The given project is used to extract information about relations.
Definition at line 909 of file qgsattributesformmodel.cpp.
| void QgsAttributesFormLayoutModel::addContainer | ( | QModelIndex & | parent, |
| const QString & | name, | ||
| int | columnCount, | ||
| Qgis::AttributeEditorContainerType | type ) |
Adds a new container to parent.
If no parent is set then the container will be forced to be a tab widget.
Definition at line 1702 of file qgsattributesformmodel.cpp.
| QgsAttributeEditorElement * QgsAttributesFormLayoutModel::createAttributeEditorWidget | ( | const QModelIndex & | index, |
| QgsAttributeEditorElement * | parent ) const |
Creates a new attribute editor element based on the definition stored in a form layout model index.
Definition at line 1579 of file qgsattributesformmodel.cpp.
|
override |
Definition at line 1156 of file qgsattributesformmodel.cpp.
|
override |
Definition at line 1437 of file qgsattributesformmodel.cpp.
|
signal |
Informs that items were inserted (via drop) in the model from another model.
|
override |
Definition at line 919 of file qgsattributesformmodel.cpp.
|
override |
Definition at line 913 of file qgsattributesformmodel.cpp.
| void QgsAttributesFormLayoutModel::insertChild | ( | const QModelIndex & | parent, |
| int | row, | ||
| const QString & | itemId, | ||
| QgsAttributesFormData::AttributesFormItemType | itemType, | ||
| const QString & | itemName ) |
Inserts a new child to parent model index at the given row position.
The child is constructed from the given itemId, itemType and itemName.
Definition at line 1721 of file qgsattributesformmodel.cpp.
|
signal |
Informs that items were moved (via drop) in the model from the same model.
| QList< QgsAddAttributeFormContainerDialog::ContainerPair > QgsAttributesFormLayoutModel::listOfContainers | ( | ) | const |
Returns a list of containers stored in the model, structured as pairs (name, container model index).
Definition at line 1697 of file qgsattributesformmodel.cpp.
|
override |
Definition at line 1389 of file qgsattributesformmodel.cpp.
|
override |
Definition at line 1343 of file qgsattributesformmodel.cpp.
|
overrideslot |
Definition at line 933 of file qgsattributesformmodel.cpp.
| bool QgsAttributesFormLayoutModel::removeRow | ( | int | row, |
| const QModelIndex & | parent = QModelIndex() ) |
Removes the index located at row within the given parent.
Definition at line 1324 of file qgsattributesformmodel.cpp.
|
override |
Definition at line 1307 of file qgsattributesformmodel.cpp.
|
override |
Definition at line 1333 of file qgsattributesformmodel.cpp.
|
override |
Definition at line 1338 of file qgsattributesformmodel.cpp.
| void QgsAttributesFormLayoutModel::updateAliasForFieldItems | ( | const QString & | fieldName, |
| const QString & | fieldAlias ) |
Updates the aliases of all matching fields in the model.
Required because a field might appear several times in the form layout.
| fieldName | Name of the field to search. |
| fieldAlias | Alias to be set to matching fields. |
Definition at line 1554 of file qgsattributesformmodel.cpp.
| void QgsAttributesFormLayoutModel::updateFieldConfigForFieldItems | ( | const QString & | fieldName, |
| const QgsAttributesFormData::FieldConfig & | config ) |
Updates the field config of all matching fields in the model.
| fieldName | Name of the field to search. |
| config | Field config to be set to matching fields. |
Definition at line 1530 of file qgsattributesformmodel.cpp.