22  qDeleteAll( mChildren );
 
 
   27  mChildren.append( widget );
 
 
   50  return mVisibilityExpression;
 
 
   63  return mCollapsedExpression;
 
 
   76  return mBackgroundColor;
 
 
   86  QList<QgsAttributeEditorElement *> results;
 
   88  const auto constMChildren = mChildren;
 
   91    if ( elem->type() == 
type )
 
   93      results.append( elem );
 
 
  109  qDeleteAll( mChildren );
 
 
  127  const auto childElements = 
children();
 
  133  element->mType = mType;
 
  134  element->mColumnCount = mColumnCount;
 
  135  element->mVisibilityExpression = mVisibilityExpression;
 
  136  element->mCollapsed = mCollapsed;
 
  137  element->mCollapsedExpression = mCollapsedExpression;
 
 
  143void QgsAttributeEditorContainer::saveConfiguration( QDomElement &elem, QDomDocument &doc )
 const 
  146  elem.setAttribute( QStringLiteral( 
"columnCount" ), mColumnCount );
 
  149  elem.setAttribute( QStringLiteral( 
"collapsed" ), mCollapsed );
 
  150  elem.setAttribute( QStringLiteral( 
"collapsedExpressionEnabled" ), mCollapsedExpression.
enabled() ? 1 : 0 );
 
  151  elem.setAttribute( QStringLiteral( 
"collapsedExpression" ), mCollapsedExpression->expression() );
 
  152  elem.setAttribute( QStringLiteral( 
"visibilityExpressionEnabled" ), mVisibilityExpression.
enabled() ? 1 : 0 );
 
  153  elem.setAttribute( QStringLiteral( 
"visibilityExpression" ), mVisibilityExpression->expression() );
 
  154  if ( mBackgroundColor.isValid() )
 
  155    elem.setAttribute( QStringLiteral( 
"backgroundColor" ), mBackgroundColor.name( ) );
 
  156  const auto constMChildren = mChildren;
 
  159    QDomDocument doc = elem.ownerDocument();
 
  160    elem.appendChild( child->toDomElement( doc ) );
 
  164void QgsAttributeEditorContainer::loadConfiguration( 
const QDomElement &element, 
const QString &layerId, 
const QgsReadWriteContext &context, 
const QgsFields &fields )
 
  166  mBackgroundColor = element.attribute( QStringLiteral( 
"backgroundColor" ), QString() );
 
  168  int cc = element.attribute( QStringLiteral( 
"columnCount" ) ).toInt( &ok );
 
  173  if ( element.hasAttribute( QStringLiteral( 
"type" ) ) )
 
  179    const bool isGroupBox = element.attribute( QStringLiteral( 
"groupBox" ) ).toInt( &ok );
 
  186  const bool isCollapsed = element.attribute( QStringLiteral( 
"collapsed" ) ).toInt( &ok );
 
  192  const bool collapsedExpressionEnabled = element.attribute( QStringLiteral( 
"collapsedExpressionEnabled" ) ).toInt( &ok );
 
  202  const bool visibilityExpressionEnabled = element.attribute( QStringLiteral( 
"visibilityExpressionEnabled" ) ).toInt( &ok );
 
  211  const QDomNodeList childNodeList = element.childNodes();
 
  213  for ( 
int i = 0; i < childNodeList.size(); i++ )
 
  215    const QDomElement childElem = childNodeList.at( i ).toElement();
 
  223QString QgsAttributeEditorContainer::typeIdentifier()
 const 
  225  return QStringLiteral( 
"attributeEditorContainer" );
 
Provides global constants and enumerations for use throughout the application.
 
AttributeEditorType
Attribute editor types.
 
A container for attribute editors, used to group them visually in the attribute form if it is set to ...
 
virtual void addChildElement(QgsAttributeEditorElement *element)
Add a child element to this container.
 
QgsOptionalExpression visibilityExpression() const
The visibility expression is used in the attribute form to show or hide this container based on an ex...
 
void setColumnCount(int columnCount)
Set the number of columns in this group.
 
~QgsAttributeEditorContainer() override
 
void setVisibilityExpression(const QgsOptionalExpression &visibilityExpression)
The visibility expression is used in the attribute form to show or hide this container based on an ex...
 
QgsOptionalExpression collapsedExpression() const
The collapsed expression is used in the attribute form to set the collapsed status of the group box c...
 
Qgis::AttributeEditorContainerType type() const
Returns the container type.
 
void setType(Qgis::AttributeEditorContainerType type)
Sets the container type.
 
void setCollapsedExpression(const QgsOptionalExpression &collapsedExpression)
The collapsed expression is used in the attribute form to set the collapsed status of the group box o...
 
QList< QgsAttributeEditorElement * > children() const
Gets a list of the children elements of this container.
 
virtual Q_DECL_DEPRECATED void setIsGroupBox(bool isGroupBox)
Determines if this container is rendered as collapsible group box or tab in a tabwidget.
 
void clear()
Clear all children from this container.
 
QgsAttributeEditorElement * clone(QgsAttributeEditorElement *parent) const override
Creates a deep copy of this element.
 
void setName(const QString &name)
Change the name of this container.
 
QColor backgroundColor() const
Returns the background color of the container.
 
void setCollapsed(bool collapsed)
For group box containers sets if this group box is collapsed.
 
virtual Q_DECL_DEPRECATED bool isGroupBox() const
Returns if this container is going to be a group box.
 
virtual QList< QgsAttributeEditorElement * > findElements(Qgis::AttributeEditorType type) const
Traverses the element tree to find any element of the specified type.
 
int columnCount() const
Gets the number of columns in this group.
 
void setBackgroundColor(const QColor &backgroundColor)
Sets the background color to backgroundColor.
 
An abstract base class for any elements of a drag and drop form.
 
QgsAttributeEditorElement * parent() const
Gets the parent of this element.
 
QgsAttributeEditorElement * mParent
 
QString name() const
Returns the name of this element.
 
static QgsAttributeEditorElement * create(const QDomElement &element, const QString &layerId, const QgsFields &fields, const QgsReadWriteContext &context, QgsAttributeEditorElement *parent=nullptr)
Constructs the editor element from the given element.
 
Handles parsing and evaluation of expressions (formerly called "search strings").
 
Container of fields for a vector layer.
 
An expression with an additional enabled flag.
 
bool enabled() const
Check if this optional is enabled.
 
void setData(const T &data)
Set the payload data.
 
void setEnabled(bool enabled)
Set if this optional is enabled.
 
A container for the context for various read/write operations on objects.
 
T qgsEnumKeyToValue(const QString &key, const T &defaultValue, bool tryValueAsKey=true, bool *returnOk=nullptr)
Returns the value corresponding to the given key of an enum.
 
QString qgsEnumValueToKey(const T &value, bool *returnOk=nullptr)
Returns the value for the given key of an enum.