QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
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"
22
29{
30 public:
31
40 : QgsAttributeEditorElement( Qgis::AttributeEditorType::Container, name, parent )
41 , mBackgroundColor( backgroundColor )
42 {}
43
45
51 virtual void addChildElement( QgsAttributeEditorElement *element SIP_TRANSFER );
52
60
67 Qgis::AttributeEditorContainerType type() const { return mType; }
68
75 Q_DECL_DEPRECATED virtual void setIsGroupBox( bool isGroupBox ) SIP_DEPRECATED;
76
84 Q_DECL_DEPRECATED virtual bool isGroupBox() const SIP_DEPRECATED;
85
94 bool collapsed() const { return mCollapsed; };
95
103 void setCollapsed( bool collapsed ) { mCollapsed = collapsed; };
104
110 QList<QgsAttributeEditorElement *> children() const { return mChildren; }
111
119 virtual QList<QgsAttributeEditorElement *> findElements( Qgis::AttributeEditorType type ) const;
120
124 void clear();
125
129 void setName( const QString &name );
130
136 int columnCount() const;
137
143 void setColumnCount( int columnCount );
144
150
157 QgsOptionalExpression visibilityExpression() const;
158
165 void setVisibilityExpression( const QgsOptionalExpression &visibilityExpression );
166
177 QgsOptionalExpression collapsedExpression() const SIP_SKIP;
178
189 void setCollapsedExpression( const QgsOptionalExpression &collapsedExpression ) SIP_SKIP;
190
197 QColor backgroundColor() const;
198
204 void setBackgroundColor( const QColor &backgroundColor );
205
206 private:
207 void saveConfiguration( QDomElement &elem, QDomDocument &doc ) const override;
208 void loadConfiguration( const QDomElement &element, const QString &layerId, const QgsReadWriteContext &context, const QgsFields &fields ) override;
209 QString typeIdentifier() const override;
210
211 Qgis::AttributeEditorContainerType mType = Qgis::AttributeEditorContainerType::GroupBox;
212 QList<QgsAttributeEditorElement *> mChildren;
213 int mColumnCount = 1;
214 QgsOptionalExpression mVisibilityExpression;
215 QColor mBackgroundColor;
216 bool mCollapsed = false;
217 QgsOptionalExpression mCollapsedExpression;
218};
219
220
221#endif // QGSATTRIBUTEEDITORCONTAINER_H
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:56
AttributeEditorContainerType
Attribute editor container types.
Definition qgis.h:5470
AttributeEditorType
Attribute editor types.
Definition qgis.h:5451
A container for attribute editors, used to group them visually in the attribute form if it is set to ...
QgsAttributeEditorContainer(const QString &name, QgsAttributeEditorElement *parent, const QColor &backgroundColor=QColor())
Creates a new attribute editor container.
bool collapsed() const
For group box containers returns true if this group box is collapsed.
Qgis::AttributeEditorContainerType type() const
Returns the container type.
void setType(Qgis::AttributeEditorContainerType type)
Sets the container type.
QList< QgsAttributeEditorElement * > children() const
Gets a list of the children elements 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.
An abstract base class for any elements of a drag and drop form.
QgsAttributeEditorElement * parent() const
Gets the parent of this element.
QgsAttributeEditorElement(Qgis::AttributeEditorType type, const QString &name, QgsAttributeEditorElement *parent=nullptr)
Constructor.
QString name() const
Returns the name of this element.
virtual QgsAttributeEditorElement * clone(QgsAttributeEditorElement *parent) const =0
Returns a clone of this element.
Container of fields for a vector layer.
Definition qgsfields.h:46
An expression with an additional enabled flag.
A container for the context for various read/write operations on objects.
#define SIP_DEPRECATED
Definition qgis_sip.h:114
#define SIP_SKIP
Definition qgis_sip.h:134
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_FACTORY
Definition qgis_sip.h:84