Skip to content

Commit

Permalink
move QgsAttributeEditorContainer to proper cpp file
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids authored and nyalldawson committed Jan 9, 2021
1 parent 9ee5e56 commit e0c0c06
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 48 deletions.
49 changes: 49 additions & 0 deletions src/core/qgsattributeeditorelement.cpp
Expand Up @@ -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 );
Expand Down
48 changes: 0 additions & 48 deletions src/core/qgseditformconfig.cpp
Expand Up @@ -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.