QGIS API Documentation 3.99.0-Master (d270888f95f)
Loading...
Searching...
No Matches
qgsattributeeditorspacerelement.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsattributeeditorspacerelement.cpp - QgsAttributeEditorSpacerElement
3
4 ---------------------
5 begin : 16.1.2023
6 copyright : (C) 2023 by Alessandro Pasotti
7 email : elpaso at itopen dot it
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 ***************************************************************************/
17
18#include <QDomElement>
19#include <QString>
20
21using namespace Qt::StringLiterals;
22
27
28void QgsAttributeEditorSpacerElement::saveConfiguration( QDomElement &elem, QDomDocument &doc ) const
29{
30 Q_UNUSED( doc );
31 elem.setAttribute( u"drawLine"_s, mDrawLine ? 1 : 0 );
32}
33
34void QgsAttributeEditorSpacerElement::loadConfiguration( const QDomElement &element, const QString &layerId, const QgsReadWriteContext &context, const QgsFields &fields )
35{
36 // Nothing to load
37 Q_UNUSED( layerId );
38 Q_UNUSED( context );
39 Q_UNUSED( fields );
40
41 bool ok;
42 const bool drawLine = element.attribute( u"drawLine"_s ).toInt( &ok );
43 if ( ok )
44 mDrawLine = drawLine;
45}
46
47QString QgsAttributeEditorSpacerElement::typeIdentifier() const
48{
49 return u"attributeEditorSpacerElement"_s;
50}
51
53{
54 return mDrawLine;
55}
56
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.
void setDrawLine(bool drawLine)
Sets a flag to define if the spacer element will contain an horizontal line.
QgsAttributeEditorSpacerElement(const QString &name, QgsAttributeEditorElement *parent)
Creates a new element which represents a spacer.
QgsAttributeEditorElement * clone(QgsAttributeEditorElement *parent) const override
Returns a clone of this element.
bool drawLine() const
Returns true if the spacer element will contain an horizontal line.
Container of fields for a vector layer.
Definition qgsfields.h:46
A container for the context for various read/write operations on objects.