QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
qgsattributeeditorcontainer.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsattributeeditorcontainer.h - QgsAttributeEditorElement
3
4 ---------------------
5 begin : 12.01.2021
6 copyright : (C) 2021 by Denis Rouzaud
8 ***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16#ifndef QGSATTRIBUTEEDITORCONTAINER_H
17#define QGSATTRIBUTEEDITORCONTAINER_H
18
19#include "qgis_core.h"
21
28{
29 public:
30
38 QgsAttributeEditorContainer( const QString &name, QgsAttributeEditorElement *parent, const QColor &backgroundColor = QColor() )
39 : QgsAttributeEditorElement( AeTypeContainer, name, parent )
40 , mIsGroupBox( true )
41 , mColumnCount( 1 )
42 , mBackgroundColor( backgroundColor )
43 {}
44
45
47
53 virtual void addChildElement( QgsAttributeEditorElement *element SIP_TRANSFER );
54
60 virtual void setIsGroupBox( bool isGroupBox ) { mIsGroupBox = isGroupBox; }
61
67 virtual bool isGroupBox() const { return mIsGroupBox; }
68
77 bool collapsed() const { return mCollapsed; };
78
86 void setCollapsed( bool collapsed ) { mCollapsed = collapsed; };
87
93 QList<QgsAttributeEditorElement *> children() const { return mChildren; }
94
102 virtual QList<QgsAttributeEditorElement *> findElements( AttributeEditorType type ) const;
103
107 void clear();
108
112 void setName( const QString &name );
113
117 int columnCount() const;
118
122 void setColumnCount( int columnCount );
123
130
138 QgsOptionalExpression visibilityExpression() const;
139
147 void setVisibilityExpression( const QgsOptionalExpression &visibilityExpression );
148
159 QgsOptionalExpression collapsedExpression() const SIP_SKIP;
160
171 void setCollapsedExpression( const QgsOptionalExpression &collapsedExpression ) SIP_SKIP;
172
178 QColor backgroundColor() const;
179
183 void setBackgroundColor( const QColor &backgroundColor );
184
185 private:
186 void saveConfiguration( QDomElement &elem, QDomDocument &doc ) const override;
187 void loadConfiguration( const QDomElement &element, const QString &layerId, const QgsReadWriteContext &context, const QgsFields &fields ) override;
188 QString typeIdentifier() const override;
189
190 bool mIsGroupBox;
191 QList<QgsAttributeEditorElement *> mChildren;
192 int mColumnCount;
193 QgsOptionalExpression mVisibilityExpression;
194 QColor mBackgroundColor;
195 bool mCollapsed = false;
196 QgsOptionalExpression mCollapsedExpression;
197};
198
199
200#endif // QGSATTRIBUTEEDITORCONTAINER_H
This is a container for attribute editors, used to group them visually in the attribute form if it is...
QgsAttributeEditorContainer(const QString &name, QgsAttributeEditorElement *parent, const QColor &backgroundColor=QColor())
Creates a new attribute editor container.
virtual bool isGroupBox() const
Returns if this container is going to be a group box.
bool collapsed() const
For group box containers returns if this group box is collapsed.
virtual void setIsGroupBox(bool isGroupBox)
Determines if this container is rendered as collapsible group box or tab in a tabwidget.
QList< QgsAttributeEditorElement * > children() const
Gets a list of the children elements of this container.
void setCollapsed(bool collapsed)
For group box containers sets if this group box is collapsed.
This is an abstract base class for any elements of a drag and drop form.
virtual QgsAttributeEditorElement * clone(QgsAttributeEditorElement *parent) const =0
Returns a clone of this element.
Container of fields for a vector layer.
Definition: qgsfields.h:45
An expression with an additional enabled flag.
The class is used as a container of context for various read/write operations on other objects.
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_TRANSFER
Definition: qgis_sip.h:36
#define SIP_FACTORY
Definition: qgis_sip.h:76