Skip to content
Permalink
Browse files

move QgsAttributeEditorContainer to proper cpp file

  • Loading branch information
3nids authored and nyalldawson committed Jan 9, 2021
1 parent 9ee5e56 commit e0c0c06fdfe4d781f96e834a3badb7609bce71d5
Showing with 49 additions and 48 deletions.
  1. +49 −0 src/core/qgsattributeeditorelement.cpp
  2. +0 −48 src/core/qgseditformconfig.cpp
@@ -80,6 +80,55 @@ void QgsAttributeEditorContainer::clear()
mChildren.clear();
}

int QgsAttributeEditorContainer::columnCount() const
{
return mColumnCount;
}

void QgsAttributeEditorContainer::setColumnCount( int columnCount )
{
mColumnCount = columnCount;
}

QgsAttributeEditorElement *QgsAttributeEditorContainer::clone( QgsAttributeEditorElement *parent ) const
{
QgsAttributeEditorContainer *element = new QgsAttributeEditorContainer( name(), parent );

const auto childElements = children();

for ( QgsAttributeEditorElement *child : childElements )
{
element->addChildElement( child->clone( element ) );
}
element->mIsGroupBox = mIsGroupBox;
element->mColumnCount = mColumnCount;
element->mVisibilityExpression = mVisibilityExpression;

return element;
}

void QgsAttributeEditorContainer::saveConfiguration( QDomElement &elem ) const
{
elem.setAttribute( QStringLiteral( "columnCount" ), mColumnCount );
elem.setAttribute( QStringLiteral( "groupBox" ), mIsGroupBox ? 1 : 0 );
elem.setAttribute( QStringLiteral( "visibilityExpressionEnabled" ), mVisibilityExpression.enabled() ? 1 : 0 );
elem.setAttribute( QStringLiteral( "visibilityExpression" ), mVisibilityExpression->expression() );
if ( mBackgroundColor.isValid() )
elem.setAttribute( QStringLiteral( "backgroundColor" ), mBackgroundColor.name( ) );
const auto constMChildren = mChildren;
for ( QgsAttributeEditorElement *child : constMChildren )
{
QDomDocument doc = elem.ownerDocument();
elem.appendChild( child->toDomElement( doc ) );
}
}

QString QgsAttributeEditorContainer::typeIdentifier() const
{
return QStringLiteral( "attributeEditorContainer" );
}


QgsAttributeEditorElement *QgsAttributeEditorField::clone( QgsAttributeEditorElement *parent ) const
{
QgsAttributeEditorField *element = new QgsAttributeEditorField( name(), mIdx, parent );
@@ -742,51 +742,3 @@ QgsAttributeEditorElement *QgsEditFormConfig::attributeEditorElementFromDomEleme

return newElement;
}

int QgsAttributeEditorContainer::columnCount() const
{
return mColumnCount;
}

void QgsAttributeEditorContainer::setColumnCount( int columnCount )
{
mColumnCount = columnCount;
}

QgsAttributeEditorElement *QgsAttributeEditorContainer::clone( QgsAttributeEditorElement *parent ) const
{
QgsAttributeEditorContainer *element = new QgsAttributeEditorContainer( name(), parent );

const auto childElements = children();

for ( QgsAttributeEditorElement *child : childElements )
{
element->addChildElement( child->clone( element ) );
}
element->mIsGroupBox = mIsGroupBox;
element->mColumnCount = mColumnCount;
element->mVisibilityExpression = mVisibilityExpression;

return element;
}

void QgsAttributeEditorContainer::saveConfiguration( QDomElement &elem ) const
{
elem.setAttribute( QStringLiteral( "columnCount" ), mColumnCount );
elem.setAttribute( QStringLiteral( "groupBox" ), mIsGroupBox ? 1 : 0 );
elem.setAttribute( QStringLiteral( "visibilityExpressionEnabled" ), mVisibilityExpression.enabled() ? 1 : 0 );
elem.setAttribute( QStringLiteral( "visibilityExpression" ), mVisibilityExpression->expression() );
if ( mBackgroundColor.isValid() )
elem.setAttribute( QStringLiteral( "backgroundColor" ), mBackgroundColor.name( ) );
const auto constMChildren = mChildren;
for ( QgsAttributeEditorElement *child : constMChildren )
{
QDomDocument doc = elem.ownerDocument();
elem.appendChild( child->toDomElement( doc ) );
}
}

QString QgsAttributeEditorContainer::typeIdentifier() const
{
return QStringLiteral( "attributeEditorContainer" );
}

0 comments on commit e0c0c06

Please sign in to comment.
You can’t perform that action at this time.