QGIS API Documentation 3.99.0-Master (21b3aa880ba)
Loading...
Searching...
No Matches
QgsAttributesFormItem Class Reference

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

#include <qgsattributesformmodel.h>

Inheritance diagram for QgsAttributesFormItem:

Signals

void addedChildren (QgsAttributesFormItem *item, int indexFrom, int indexTo)
 Notifies other objects when children have been added to the item, informing the indices where added children are located.

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.

Static Public Member Functions

static bool isGroup (QgsAttributesFormItem *item)
 Returns whether the item is a group.

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 379 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 179 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 186 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 261 of file qgsattributesformmodel.cpp.

◆ addedChildren

void QgsAttributesFormItem::addedChildren ( QgsAttributesFormItem * item,
int indexFrom,
int indexTo )
signal

Notifies other objects when children have been added to the item, informing the indices where added children are located.

Since
QGIS 4.0

◆ 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 194 of file qgsattributesformmodel.cpp.

◆ childCount()

int QgsAttributesFormItem::childCount ( ) const

Returns the number of children items for the given item.

Definition at line 239 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 309 of file qgsattributesformmodel.cpp.

◆ deleteChildAtIndex()

void QgsAttributesFormItem::deleteChildAtIndex ( int index)

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

Definition at line 293 of file qgsattributesformmodel.cpp.

◆ deleteChildren()

void QgsAttributesFormItem::deleteChildren ( )

Deletes all child items from this item.

Definition at line 299 of file qgsattributesformmodel.cpp.

◆ displayName()

QString QgsAttributesFormItem::displayName ( ) const
inline

Returns the display name of the item.

Definition at line 496 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 218 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 202 of file qgsattributesformmodel.cpp.

◆ icon()

QIcon QgsAttributesFormItem::icon ( ) const
inline

Returns the icon of the item.

See also
setIcon()

Definition at line 503 of file qgsattributesformmodel.h.

◆ id()

QString QgsAttributesFormItem::id ( ) const
inline

Returns the id of the item.

Definition at line 486 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 277 of file qgsattributesformmodel.cpp.

◆ isGroup()

bool QgsAttributesFormItem::isGroup ( QgsAttributesFormItem * item)
static

Returns whether the item is a group.

That is, a container or a widget type (e.g., Fields, Relations, Actions, etc.) item.

Since
QGIS 4.0

Definition at line 304 of file qgsattributesformmodel.cpp.

◆ name()

QString QgsAttributesFormItem::name ( ) const
inline

Returns the name of the item.

Definition at line 491 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 441 of file qgsattributesformmodel.h.

◆ row()

int QgsAttributesFormItem::row ( ) const

Returns the position of the item regarding its parent.

Definition at line 244 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 330 of file qgsattributesformmodel.cpp.

◆ setIcon()

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

Sets an icon for the item.

See also
icon()

Definition at line 510 of file qgsattributesformmodel.h.

◆ type()

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

Returns the type of the item.

Definition at line 481 of file qgsattributesformmodel.h.


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