QGIS API Documentation 3.43.0-Master (56aa1fd18d7)
|
Holds parent-child relations as well as item data contained in a QgsAttributesFormModel. More...
#include <qgsattributesformmodel.h>
Public Member Functions | |
QgsAttributesFormItem ()=default | |
QgsAttributesFormItem (QgsAttributesFormData::AttributesFormItemType itemType, const QgsAttributesFormData::AttributeFormItemData &data, const QString &name, const QString &displayName=QString(), QgsAttributesFormItem *parent=nullptr) | |
Constructor for QgsAttributesFormItem, with the given itemType, the given data and the given name. | |
QgsAttributesFormItem (QgsAttributesFormData::AttributesFormItemType itemType, const QString &name, const QString &displayName=QString(), QgsAttributesFormItem *parent=nullptr) | |
Constructor for QgsAttributesFormItem, with the given itemType and the given name. | |
void | addChild (std::unique_ptr< QgsAttributesFormItem > &&child) |
Appends a child to this item. | |
QgsAttributesFormItem * | child (int row) |
Access the child item located at row position. | |
int | childCount () const |
Returns the number of children items for the given item. | |
QVariant | data (int role) const |
Returns the data stored in the item, corresponding to the given role. | |
void | deleteChildAtIndex (int index) |
Deletes the child of the item placed at the given index. | |
void | deleteChildren () |
Deletes all child items from this item. | |
QString | displayName () const |
Returns the display name of the item. | |
QgsAttributesFormItem * | firstChildRecursive (const QgsAttributesFormData::AttributesFormItemType &itemType, const QString &itemId) const |
Access the first child item that matches itemType and itemId, recursively. | |
QgsAttributesFormItem * | firstTopChild (const QgsAttributesFormData::AttributesFormItemType itemType, const QString &itemId) const |
Access the first top-level child item that matches itemType and itemId. | |
QIcon | icon () const |
Returns the icon of the item. | |
QString | id () const |
Returns the id of the item. | |
void | insertChild (int position, std::unique_ptr< QgsAttributesFormItem > &&item) |
Inserts a child item to the item at a given position. | |
QString | name () const |
Returns the name of the item. | |
QgsAttributesFormItem * | parent () |
Returns the parent object of the item. | |
int | row () const |
Returns the position of the item regarding its parent. | |
bool | setData (int role, const QVariant &value) |
Stores a data value in a given role inside the item. | |
void | setIcon (const QIcon &icon) |
Sets an icon for the item. | |
QgsAttributesFormData::AttributesFormItemType | type () const |
Returns the type of the item. | |
Holds parent-child relations as well as item data contained in a QgsAttributesFormModel.
Definition at line 375 of file qgsattributesformmodel.h.
|
default |
|
explicit |
Constructor for QgsAttributesFormItem, with the given itemType and the given name.
If displayName is specified then it will be used as the preferred display name for the item. If it is not specified, name will be displayed instead.
If parent is specified, the item will be added as child of the parent item. If it is not specified then it will be set when manually added to another item.
Definition at line 175 of file qgsattributesformmodel.cpp.
|
explicit |
Constructor for QgsAttributesFormItem, with the given itemType, the given data and the given name.
If displayName is specified then it will be used as the preferred display name for the item. If it is not specified, name will be displayed instead.
If parent is specified, the item will be added as child of the parent item. If it is not specified then it will be set when manually added to another item.
Definition at line 182 of file qgsattributesformmodel.cpp.
void QgsAttributesFormItem::addChild | ( | std::unique_ptr< QgsAttributesFormItem > && | child | ) |
Appends a child to this item.
Takes ownership of the child.
Definition at line 257 of file qgsattributesformmodel.cpp.
QgsAttributesFormItem * QgsAttributesFormItem::child | ( | int | row | ) |
Access the child item located at row position.
If there is no child item for the given row position, a nullptr
is returned.
Definition at line 190 of file qgsattributesformmodel.cpp.
int QgsAttributesFormItem::childCount | ( | ) | const |
Returns the number of children items for the given item.
Definition at line 235 of file qgsattributesformmodel.cpp.
QVariant QgsAttributesFormItem::data | ( | int | role | ) | const |
Returns the data stored in the item, corresponding to the given role.
Definition at line 290 of file qgsattributesformmodel.cpp.
void QgsAttributesFormItem::deleteChildAtIndex | ( | int | index | ) |
Deletes the child of the item placed at the given index.
Definition at line 279 of file qgsattributesformmodel.cpp.
void QgsAttributesFormItem::deleteChildren | ( | ) |
Deletes all child items from this item.
Definition at line 285 of file qgsattributesformmodel.cpp.
|
inline |
Returns the display name of the item.
Definition at line 492 of file qgsattributesformmodel.h.
QgsAttributesFormItem * QgsAttributesFormItem::firstChildRecursive | ( | const QgsAttributesFormData::AttributesFormItemType & | itemType, |
const QString & | itemId | ||
) | const |
Access the first child item that matches itemType and itemId, recursively.
If there is no matching child item in the whole item hierarchy, a nullptr
is returned.
Definition at line 214 of file qgsattributesformmodel.cpp.
QgsAttributesFormItem * QgsAttributesFormItem::firstTopChild | ( | const QgsAttributesFormData::AttributesFormItemType | itemType, |
const QString & | itemId | ||
) | const |
Access the first top-level child item that matches itemType and itemId.
If there is no top-level matching child item, a nullptr
is returned.
Definition at line 198 of file qgsattributesformmodel.cpp.
|
inline |
Returns the icon of the item.
Definition at line 499 of file qgsattributesformmodel.h.
|
inline |
Returns the id of the item.
Definition at line 482 of file qgsattributesformmodel.h.
void QgsAttributesFormItem::insertChild | ( | int | position, |
std::unique_ptr< QgsAttributesFormItem > && | item | ||
) |
Inserts a child item to the item at a given position.
Takes ownership of the child item.
Definition at line 268 of file qgsattributesformmodel.cpp.
|
inline |
Returns the name of the item.
Definition at line 487 of file qgsattributesformmodel.h.
|
inline |
Returns the parent object of the item.
If item is a top-level item, its parent is the root object and a nullptr
is returned.
Definition at line 437 of file qgsattributesformmodel.h.
int QgsAttributesFormItem::row | ( | ) | const |
Returns the position of the item regarding its parent.
Definition at line 240 of file qgsattributesformmodel.cpp.
bool QgsAttributesFormItem::setData | ( | int | role, |
const QVariant & | value | ||
) |
Stores a data value in a given role inside the item.
Definition at line 311 of file qgsattributesformmodel.cpp.
|
inline |
|
inline |
Returns the type of the item.
Definition at line 477 of file qgsattributesformmodel.h.