QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
QgsAttributeEditorContainer Class Reference

This is a container for attribute editors, used to group them visually in the attribute form if it is set to the drag and drop designer. More...

#include <qgsattributeeditorcontainer.h>

Inheritance diagram for QgsAttributeEditorContainer:
Inheritance graph
[legend]

Public Member Functions

 QgsAttributeEditorContainer (const QString &name, QgsAttributeEditorElement *parent, const QColor &backgroundColor=QColor())
 Creates a new attribute editor container.
 
 ~QgsAttributeEditorContainer () override
 
virtual void addChildElement (QgsAttributeEditorElement *element)
 Add a child element to this container.
 
QColor backgroundColor () const
 Returns the background color of the container.
 
QList< QgsAttributeEditorElement * > children () const
 Gets a list of the children elements of this container.
 
void clear ()
 Clear all children from this container.
 
QgsAttributeEditorElementclone (QgsAttributeEditorElement *parent) const override
 Creates a deep copy of this element.
 
bool collapsed () const
 For group box containers returns true if this group box is collapsed.
 
QgsOptionalExpression collapsedExpression () const
 The collapsed expression is used in the attribute form to set the collapsed status of the group box container container based on an expression incorporating the field value controlled by editor widgets.
 
int columnCount () const
 Gets the number of columns in this group.
 
virtual QList< QgsAttributeEditorElement * > findElements (Qgis::AttributeEditorType type) const
 Traverses the element tree to find any element of the specified type.
 
virtual Q_DECL_DEPRECATED bool isGroupBox () const
 Returns if this container is going to be a group box.
 
void setBackgroundColor (const QColor &backgroundColor)
 Sets the background color to backgroundColor.
 
void setCollapsed (bool collapsed)
 For group box containers sets if this group box is collapsed.
 
void setCollapsedExpression (const QgsOptionalExpression &collapsedExpression)
 The collapsed expression is used in the attribute form to set the collapsed status of the group box of this container based on an expression incorporating the field value controlled by editor widgets.
 
void setColumnCount (int columnCount)
 Set the number of columns in this group.
 
virtual Q_DECL_DEPRECATED void setIsGroupBox (bool isGroupBox)
 Determines if this container is rendered as collapsible group box or tab in a tabwidget.
 
void setName (const QString &name)
 Change the name of this container.
 
void setType (Qgis::AttributeEditorContainerType type)
 Sets the container type.
 
void setVisibilityExpression (const QgsOptionalExpression &visibilityExpression)
 The visibility expression is used in the attribute form to show or hide this container based on an expression incorporating the field value controlled by editor widgets.
 
Qgis::AttributeEditorContainerType type () const
 Returns the container type.
 
QgsOptionalExpression visibilityExpression () const
 The visibility expression is used in the attribute form to show or hide this container based on an expression incorporating the field value controlled by editor widgets.
 
- Public Member Functions inherited from QgsAttributeEditorElement
 QgsAttributeEditorElement (Qgis::AttributeEditorType type, const QString &name, QgsAttributeEditorElement *parent=nullptr)
 Constructor.
 
virtual ~QgsAttributeEditorElement ()=default
 
int horizontalStretch () const
 Returns the horizontal stretch factor for the element.
 
LabelStyle labelStyle () const
 Returns the label style.
 
QString name () const
 Returns the name of this element.
 
QgsAttributeEditorElementparent () const
 Gets the parent of this element.
 
void setHorizontalStretch (int stretch)
 Sets the horizontal stretch factor for the element.
 
void setLabelStyle (const LabelStyle &labelStyle)
 Sets the labelStyle.
 
void setShowLabel (bool showLabel)
 Controls if this element should be labeled with a title (field, relation or groupname).
 
void setVerticalStretch (int stretch)
 Sets the vertical stretch factor for the element.
 
bool showLabel () const
 Controls if this element should be labeled with a title (field, relation or groupname).
 
QDomElement toDomElement (QDomDocument &doc) const
 Gets the XML Dom element to save this element.
 
Qgis::AttributeEditorType type () const
 The type of this element.
 
int verticalStretch () const
 Returns the vertical stretch factor for the element.
 

Additional Inherited Members

- Static Public Member Functions inherited from QgsAttributeEditorElement
static QgsAttributeEditorElementcreate (const QDomElement &element, const QString &layerId, const QgsFields &fields, const QgsReadWriteContext &context, QgsAttributeEditorElement *parent=nullptr)
 Constructs the editor element from the given element.
 
- Protected Attributes inherited from QgsAttributeEditorElement
int mHorizontalStretch = 0
 
LabelStyle mLabelStyle
 
QString mName
 
QgsAttributeEditorElementmParent = nullptr
 
bool mShowLabel = true
 
Qgis::AttributeEditorType mType = Qgis::AttributeEditorType::Invalid
 
int mVerticalStretch = 0
 

Detailed Description

This is a container for attribute editors, used to group them visually in the attribute form if it is set to the drag and drop designer.

Definition at line 28 of file qgsattributeeditorcontainer.h.

Constructor & Destructor Documentation

◆ QgsAttributeEditorContainer()

QgsAttributeEditorContainer::QgsAttributeEditorContainer ( const QString &  name,
QgsAttributeEditorElement parent,
const QColor &  backgroundColor = QColor() 
)
inline

Creates a new attribute editor container.

Parameters
nameThe name to show as title
parentThe parent. May be another container.
backgroundColorThe optional background color of the container.

Definition at line 39 of file qgsattributeeditorcontainer.h.

◆ ~QgsAttributeEditorContainer()

QgsAttributeEditorContainer::~QgsAttributeEditorContainer ( )
override

Definition at line 20 of file qgsattributeeditorcontainer.cpp.

Member Function Documentation

◆ addChildElement()

void QgsAttributeEditorContainer::addChildElement ( QgsAttributeEditorElement element)
virtual

Add a child element to this container.

This may be another container, a field or a relation.

Parameters
elementThe element to add as child

Definition at line 25 of file qgsattributeeditorcontainer.cpp.

◆ backgroundColor()

QColor QgsAttributeEditorContainer::backgroundColor ( ) const

Returns the background color of the container.

See also
setBackgroundColor()
Since
QGIS 3.8

Definition at line 74 of file qgsattributeeditorcontainer.cpp.

◆ children()

QList< QgsAttributeEditorElement * > QgsAttributeEditorContainer::children ( ) const
inline

Gets a list of the children elements of this container.

Returns
A list of elements

Definition at line 110 of file qgsattributeeditorcontainer.h.

◆ clear()

void QgsAttributeEditorContainer::clear ( )

Clear all children from this container.

Definition at line 107 of file qgsattributeeditorcontainer.cpp.

◆ clone()

QgsAttributeEditorElement * QgsAttributeEditorContainer::clone ( QgsAttributeEditorElement parent) const
overridevirtual

Creates a deep copy of this element.

To be implemented by subclasses.

Implements QgsAttributeEditorElement.

Definition at line 123 of file qgsattributeeditorcontainer.cpp.

◆ collapsed()

bool QgsAttributeEditorContainer::collapsed ( ) const
inline

For group box containers returns true if this group box is collapsed.

Returns
true if the group box is collapsed, false otherwise.
See also
collapsed()
setCollapsed()
Since
QGIS 3.26

Definition at line 94 of file qgsattributeeditorcontainer.h.

◆ collapsedExpression()

QgsOptionalExpression QgsAttributeEditorContainer::collapsedExpression ( ) const

The collapsed expression is used in the attribute form to set the collapsed status of the group box container container based on an expression incorporating the field value controlled by editor widgets.

This property is ignored if the container is not a group box.

Note
Not available in Python bindings
See also
setCollapsedExpression()
Since
QGIS 3.26

Definition at line 61 of file qgsattributeeditorcontainer.cpp.

◆ columnCount()

int QgsAttributeEditorContainer::columnCount ( ) const

Gets the number of columns in this group.

See also
setColumnCount()

Definition at line 113 of file qgsattributeeditorcontainer.cpp.

◆ findElements()

QList< QgsAttributeEditorElement * > QgsAttributeEditorContainer::findElements ( Qgis::AttributeEditorType  type) const
virtual

Traverses the element tree to find any element of the specified type.

Parameters
typeThe type which should be searched
Returns
A list of elements of the type which has been searched for

Definition at line 84 of file qgsattributeeditorcontainer.cpp.

◆ isGroupBox()

bool QgsAttributeEditorContainer::isGroupBox ( ) const
virtual

Returns if this container is going to be a group box.

Returns
true if it will be a group box, false if it will be a tab
Deprecated:
QGIS 3.40. Use type() instead.

Definition at line 38 of file qgsattributeeditorcontainer.cpp.

◆ setBackgroundColor()

void QgsAttributeEditorContainer::setBackgroundColor ( const QColor &  backgroundColor)

Sets the background color to backgroundColor.

See also
backgroundColor()

Definition at line 79 of file qgsattributeeditorcontainer.cpp.

◆ setCollapsed()

void QgsAttributeEditorContainer::setCollapsed ( bool  collapsed)
inline

For group box containers sets if this group box is collapsed.

See also
collapsed()
setCollapsed()
Since
QGIS 3.26

Definition at line 103 of file qgsattributeeditorcontainer.h.

◆ setCollapsedExpression()

void QgsAttributeEditorContainer::setCollapsedExpression ( const QgsOptionalExpression collapsedExpression)

The collapsed expression is used in the attribute form to set the collapsed status of the group box of this container based on an expression incorporating the field value controlled by editor widgets.

This property is ignored if the container is not a group box.

Note
Not available in Python bindings
See also
collapsedExpression()
Since
QGIS 3.26

Definition at line 66 of file qgsattributeeditorcontainer.cpp.

◆ setColumnCount()

void QgsAttributeEditorContainer::setColumnCount ( int  columnCount)

Set the number of columns in this group.

See also
columnCount()

Definition at line 118 of file qgsattributeeditorcontainer.cpp.

◆ setIsGroupBox()

void QgsAttributeEditorContainer::setIsGroupBox ( bool  isGroupBox)
virtual

Determines if this container is rendered as collapsible group box or tab in a tabwidget.

Parameters
isGroupBoxIf true, this will be a group box
Deprecated:
QGIS 3.40. Use setType() instead.

Definition at line 30 of file qgsattributeeditorcontainer.cpp.

◆ setName()

void QgsAttributeEditorContainer::setName ( const QString &  name)

Change the name of this container.

Definition at line 43 of file qgsattributeeditorcontainer.cpp.

◆ setType()

void QgsAttributeEditorContainer::setType ( Qgis::AttributeEditorContainerType  type)
inline

Sets the container type.

See also
type()
Since
QGIS 3.32

Definition at line 59 of file qgsattributeeditorcontainer.h.

◆ setVisibilityExpression()

void QgsAttributeEditorContainer::setVisibilityExpression ( const QgsOptionalExpression visibilityExpression)

The visibility expression is used in the attribute form to show or hide this container based on an expression incorporating the field value controlled by editor widgets.

Definition at line 53 of file qgsattributeeditorcontainer.cpp.

◆ type()

Qgis::AttributeEditorContainerType QgsAttributeEditorContainer::type ( ) const
inline

Returns the container type.

See also
setType()
Since
QGIS 3.32

Definition at line 67 of file qgsattributeeditorcontainer.h.

◆ visibilityExpression()

QgsOptionalExpression QgsAttributeEditorContainer::visibilityExpression ( ) const

The visibility expression is used in the attribute form to show or hide this container based on an expression incorporating the field value controlled by editor widgets.

Definition at line 48 of file qgsattributeeditorcontainer.cpp.


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