QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
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:
39 : QgsAttributeEditorElement( Qgis::AttributeEditorType::Container, name, parent )
40 , mBackgroundColor( backgroundColor )
41 {}
42
44
50 virtual void addChildElement( QgsAttributeEditorElement *element SIP_TRANSFER );
51
59
66 Qgis::AttributeEditorContainerType type() const { return mType; }
67
74 Q_DECL_DEPRECATED virtual void setIsGroupBox( bool isGroupBox ) SIP_DEPRECATED;
75
83 Q_DECL_DEPRECATED virtual bool isGroupBox() const SIP_DEPRECATED;
84
93 bool collapsed() const { return mCollapsed; };
94
102 void setCollapsed( bool collapsed ) { mCollapsed = collapsed; };
103
109 QList<QgsAttributeEditorElement *> children() const { return mChildren; }
110
118 virtual QList<QgsAttributeEditorElement *> findElements( Qgis::AttributeEditorType type ) const;
119
123 void clear();
124
128 void setName( const QString &name );
129
135 int columnCount() const;
136
142 void setColumnCount( int columnCount );
143
149
156 QgsOptionalExpression visibilityExpression() const;
157
164 void setVisibilityExpression( const QgsOptionalExpression &visibilityExpression );
165
176 QgsOptionalExpression collapsedExpression() const SIP_SKIP;
177
188 void setCollapsedExpression( const QgsOptionalExpression &collapsedExpression ) SIP_SKIP;
189
196 QColor backgroundColor() const;
197
203 void setBackgroundColor( const QColor &backgroundColor );
204
205 private:
206 void saveConfiguration( QDomElement &elem, QDomDocument &doc ) const override;
207 void loadConfiguration( const QDomElement &element, const QString &layerId, const QgsReadWriteContext &context, const QgsFields &fields ) override;
208 QString typeIdentifier() const override;
209
210 Qgis::AttributeEditorContainerType mType = Qgis::AttributeEditorContainerType::GroupBox;
211 QList<QgsAttributeEditorElement *> mChildren;
212 int mColumnCount = 1;
213 QgsOptionalExpression mVisibilityExpression;
214 QColor mBackgroundColor;
215 bool mCollapsed = false;
216 QgsOptionalExpression mCollapsedExpression;
217};
218
219
220#endif // QGSATTRIBUTEEDITORCONTAINER_H
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:62
AttributeEditorContainerType
Attribute editor container types.
Definition qgis.h:5826
AttributeEditorType
Attribute editor types.
Definition qgis.h:5807
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:113
#define SIP_SKIP
Definition qgis_sip.h:133
#define SIP_TRANSFER
Definition qgis_sip.h:35
#define SIP_FACTORY
Definition qgis_sip.h:83