QGIS API Documentation  3.24.2-Tisler (13c1a02865)
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
7  email : [email protected]
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 
46  ~QgsAttributeEditorContainer() override;
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 
74  QList<QgsAttributeEditorElement *> children() const { return mChildren; }
75 
83  virtual QList<QgsAttributeEditorElement *> findElements( AttributeEditorType type ) const;
84 
88  void clear();
89 
93  void setName( const QString &name );
94 
98  int columnCount() const;
99 
103  void setColumnCount( int columnCount );
104 
111 
119  QgsOptionalExpression visibilityExpression() const;
120 
128  void setVisibilityExpression( const QgsOptionalExpression &visibilityExpression );
129 
135  QColor backgroundColor() const;
136 
140  void setBackgroundColor( const QColor &backgroundColor );
141 
142  private:
143  void saveConfiguration( QDomElement &elem, QDomDocument &doc ) const override;
144  void loadConfiguration( const QDomElement &element, const QString &layerId, const QgsReadWriteContext &context, const QgsFields &fields ) override;
145  QString typeIdentifier() const override;
146 
147  bool mIsGroupBox;
148  QList<QgsAttributeEditorElement *> mChildren;
149  int mColumnCount;
150  QgsOptionalExpression mVisibilityExpression;
151  QColor mBackgroundColor;
152 };
153 
154 
155 #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 rendered as a group box.
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.
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_TRANSFER
Definition: qgis_sip.h:36
#define SIP_FACTORY
Definition: qgis_sip.h:76