QGIS API Documentation 3.43.0-Master (56aa1fd18d7)
Public Slots | Public Member Functions | List of all members
QgsAttributesAvailableWidgetsModel Class Reference

Manages available widgets when configuring attributes forms. More...

#include <qgsattributesformmodel.h>

Inheritance diagram for QgsAttributesAvailableWidgetsModel:
Inheritance graph
[legend]

Public Slots

void populate () override
 
void populateLayerActions (const QList< QgsAction > actions)
 Refresh layer actions in the model to keep an updated action list.
 
- Public Slots inherited from QgsAttributesFormModel
virtual void populate ()=0
 Populates the model with initial data read from the layer.
 

Public Member Functions

 QgsAttributesAvailableWidgetsModel (QgsVectorLayer *layer, QgsProject *project, QObject *parent=nullptr)
 Constructor for QgsAttributesAvailableWidgetsModel, with the given parent.
 
QModelIndex actionContainer () const
 Returns the action container in this model, expected to be placed at the third top-level row.
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 
QModelIndex fieldContainer () const
 Returns the field container in this model, expected to be placed at the first top-level row.
 
QModelIndex fieldModelIndex (const QString &fieldName) const
 Returns the model index that corresponds to the field with the given fieldName.
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 
QMimeData * mimeData (const QModelIndexList &indexes) const override
 
QStringList mimeTypes () const override
 
QModelIndex relationContainer () const
 Returns the relation container in this model, expected to be placed at the second top-level row.
 
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
 
Qt::DropActions supportedDragActions () const override
 
- 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
 
QModelIndex parent (const QModelIndex &index) const override
 
int rowCount (const QModelIndex &parent=QModelIndex()) const 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
bool indexLessThan (const QModelIndex &a, const QModelIndex &b) const
 Auxiliary function to sort indexes, returning true if index a is less than index b.
 
QgsAttributesFormItemitemForIndex (const QModelIndex &index) const
 Returns the underlying item that corresponds to the given index.
 
QVector< int > rootToLeafPath (QgsAttributesFormItem *item) const
 Returns a QVector of iterative positions from root item to the given item.
 
- Protected Attributes inherited from QgsAttributesFormModel
QgsVectorLayermLayer
 
QgsProjectmProject
 
std::unique_ptr< QgsAttributesFormItemmRootItem
 
bool mShowAliases = false
 

Detailed Description

Manages available widgets when configuring attributes forms.

Warning
Not part of stable API and may change in future QGIS releases.
Since
QGIS 3.44

Definition at line 644 of file qgsattributesformmodel.h.

Constructor & Destructor Documentation

◆ QgsAttributesAvailableWidgetsModel()

QgsAttributesAvailableWidgetsModel::QgsAttributesAvailableWidgetsModel ( QgsVectorLayer layer,
QgsProject project,
QObject *  parent = nullptr 
)
explicit

Constructor for QgsAttributesAvailableWidgetsModel, with the given parent.

The given layer and project are the data sources to populate the model.

Definition at line 464 of file qgsattributesformmodel.cpp.

Member Function Documentation

◆ actionContainer()

QModelIndex QgsAttributesAvailableWidgetsModel::actionContainer ( ) const

Returns the action container in this model, expected to be placed at the third top-level row.

If there is no action container set, an invalid index is returned.

Definition at line 830 of file qgsattributesformmodel.cpp.

◆ data()

QVariant QgsAttributesAvailableWidgetsModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
override

Definition at line 640 of file qgsattributesformmodel.cpp.

◆ fieldContainer()

QModelIndex QgsAttributesAvailableWidgetsModel::fieldContainer ( ) const

Returns the field container in this model, expected to be placed at the first top-level row.

If there is no field container set, an invalid index is returned.

Definition at line 806 of file qgsattributesformmodel.cpp.

◆ fieldModelIndex()

QModelIndex QgsAttributesAvailableWidgetsModel::fieldModelIndex ( const QString &  fieldName) const

Returns the model index that corresponds to the field with the given fieldName.

Definition at line 842 of file qgsattributesformmodel.cpp.

◆ flags()

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

Definition at line 469 of file qgsattributesformmodel.cpp.

◆ headerData()

QVariant QgsAttributesAvailableWidgetsModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
override

Definition at line 485 of file qgsattributesformmodel.cpp.

◆ mimeData()

QMimeData * QgsAttributesAvailableWidgetsModel::mimeData ( const QModelIndexList &  indexes) const
override

Definition at line 769 of file qgsattributesformmodel.cpp.

◆ mimeTypes()

QStringList QgsAttributesAvailableWidgetsModel::mimeTypes ( ) const
override

Definition at line 764 of file qgsattributesformmodel.cpp.

◆ populate

void QgsAttributesAvailableWidgetsModel::populate ( )
overrideslot

Definition at line 491 of file qgsattributesformmodel.cpp.

◆ populateLayerActions

void QgsAttributesAvailableWidgetsModel::populateLayerActions ( const QList< QgsAction actions)
slot

Refresh layer actions in the model to keep an updated action list.

Parameters
actionsUp-to-date list of actions

Definition at line 592 of file qgsattributesformmodel.cpp.

◆ relationContainer()

QModelIndex QgsAttributesAvailableWidgetsModel::relationContainer ( ) const

Returns the relation container in this model, expected to be placed at the second top-level row.

If there is no relation container set, an invalid index is returned.

Definition at line 818 of file qgsattributesformmodel.cpp.

◆ setData()

bool QgsAttributesAvailableWidgetsModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::EditRole 
)
override

Definition at line 745 of file qgsattributesformmodel.cpp.

◆ supportedDragActions()

Qt::DropActions QgsAttributesAvailableWidgetsModel::supportedDragActions ( ) const
override

Definition at line 759 of file qgsattributesformmodel.cpp.


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