QGIS API Documentation 3.99.0-Master (26c88405ac0)
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
24
25void QgsAttributeEditorSpacerElement::saveConfiguration( QDomElement &elem, QDomDocument &doc ) const
26{
27 Q_UNUSED( doc );
28 elem.setAttribute( QStringLiteral( "drawLine" ), mDrawLine ? 1 : 0 );
29}
30
31void QgsAttributeEditorSpacerElement::loadConfiguration( const QDomElement &element, const QString &layerId, const QgsReadWriteContext &context, const QgsFields &fields )
32{
33 // Nothing to load
34 Q_UNUSED( layerId );
35 Q_UNUSED( context );
36 Q_UNUSED( fields );
37
38 bool ok;
39 const bool drawLine = element.attribute( QStringLiteral( "drawLine" ) ).toInt( &ok );
40 if ( ok )
41 mDrawLine = drawLine;
42}
43
44QString QgsAttributeEditorSpacerElement::typeIdentifier() const
45{
46 return QStringLiteral( "attributeEditorSpacerElement" );
47}
48
50{
51 return mDrawLine;
52}
53
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.