QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
QgsAttributesAvailableWidgetsModel Class Reference

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

#include <qgsattributesformmodel.h>

Inheritance diagram for QgsAttributesAvailableWidgetsModel:

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.
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
QgsAttributesFormItemitemForIndex (const QModelIndex &index) const
 Returns the underlying item that corresponds to the given index.
QModelIndex parent (const QModelIndex &index) const override
QgsAttributesFormItemrootItem () 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...
Signals inherited from QgsAttributesFormModel
void fieldConfigDataChanged (QgsAttributesFormItem *item)
 Notifies other objects that the field config data has changed in the item.
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
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 693 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 524 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 885 of file qgsattributesformmodel.cpp.

◆ data()

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

Definition at line 709 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 861 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 897 of file qgsattributesformmodel.cpp.

◆ flags()

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

Definition at line 529 of file qgsattributesformmodel.cpp.

◆ headerData()

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

Definition at line 545 of file qgsattributesformmodel.cpp.

◆ mimeData()

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

Definition at line 824 of file qgsattributesformmodel.cpp.

◆ mimeTypes()

QStringList QgsAttributesAvailableWidgetsModel::mimeTypes ( ) const
override

Definition at line 819 of file qgsattributesformmodel.cpp.

◆ populate

void QgsAttributesAvailableWidgetsModel::populate ( )
overrideslot

Definition at line 551 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 657 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 873 of file qgsattributesformmodel.cpp.

◆ supportedDragActions()

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

Definition at line 814 of file qgsattributesformmodel.cpp.


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