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

Holds parent-child relations as well as item data contained in a QgsAttributesFormModel. More...

#include <qgsattributesformmodel.h>

Inheritance diagram for QgsAttributesFormItem:
Inheritance graph
[legend]

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.
 
QgsAttributesFormItemchild (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.
 
QgsAttributesFormItemfirstChildRecursive (const QgsAttributesFormData::AttributesFormItemType &itemType, const QString &itemId) const
 Access the first child item that matches itemType and itemId, recursively.
 
QgsAttributesFormItemfirstTopChild (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.
 
QgsAttributesFormItemparent ()
 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.
 

Detailed Description

Holds parent-child relations as well as item data contained in a QgsAttributesFormModel.

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

Definition at line 375 of file qgsattributesformmodel.h.

Constructor & Destructor Documentation

◆ QgsAttributesFormItem() [1/3]

QgsAttributesFormItem::QgsAttributesFormItem ( )
default

◆ QgsAttributesFormItem() [2/3]

QgsAttributesFormItem::QgsAttributesFormItem ( QgsAttributesFormData::AttributesFormItemType  itemType,
const QString &  name,
const QString &  displayName = QString(),
QgsAttributesFormItem parent = nullptr 
)
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.

◆ QgsAttributesFormItem() [3/3]

QgsAttributesFormItem::QgsAttributesFormItem ( QgsAttributesFormData::AttributesFormItemType  itemType,
const QgsAttributesFormData::AttributeFormItemData data,
const QString &  name,
const QString &  displayName = QString(),
QgsAttributesFormItem parent = nullptr 
)
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.

Member Function Documentation

◆ addChild()

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.

◆ child()

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.

◆ childCount()

int QgsAttributesFormItem::childCount ( ) const

Returns the number of children items for the given item.

Definition at line 235 of file qgsattributesformmodel.cpp.

◆ data()

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.

◆ deleteChildAtIndex()

void QgsAttributesFormItem::deleteChildAtIndex ( int  index)

Deletes the child of the item placed at the given index.

Definition at line 279 of file qgsattributesformmodel.cpp.

◆ deleteChildren()

void QgsAttributesFormItem::deleteChildren ( )

Deletes all child items from this item.

Definition at line 285 of file qgsattributesformmodel.cpp.

◆ displayName()

QString QgsAttributesFormItem::displayName ( ) const
inline

Returns the display name of the item.

Definition at line 492 of file qgsattributesformmodel.h.

◆ firstChildRecursive()

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.

◆ firstTopChild()

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.

◆ icon()

QIcon QgsAttributesFormItem::icon ( ) const
inline

Returns the icon of the item.

See also
setIcon()

Definition at line 499 of file qgsattributesformmodel.h.

◆ id()

QString QgsAttributesFormItem::id ( ) const
inline

Returns the id of the item.

Definition at line 482 of file qgsattributesformmodel.h.

◆ insertChild()

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.

◆ name()

QString QgsAttributesFormItem::name ( ) const
inline

Returns the name of the item.

Definition at line 487 of file qgsattributesformmodel.h.

◆ parent()

QgsAttributesFormItem * QgsAttributesFormItem::parent ( )
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.

◆ row()

int QgsAttributesFormItem::row ( ) const

Returns the position of the item regarding its parent.

Definition at line 240 of file qgsattributesformmodel.cpp.

◆ setData()

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.

◆ setIcon()

void QgsAttributesFormItem::setIcon ( const QIcon &  icon)
inline

Sets an icon for the item.

See also
icon()

Definition at line 506 of file qgsattributesformmodel.h.

◆ type()

QgsAttributesFormData::AttributesFormItemType QgsAttributesFormItem::type ( ) const
inline

Returns the type of the item.

Definition at line 477 of file qgsattributesformmodel.h.


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