Skip to content
Permalink
Browse files

make QgsRelation::RelationStrength a Q_ENUM and simplify code

  • Loading branch information
3nids committed Sep 10, 2020
1 parent 27422fd commit e87ba45edcfa0d1fd231e3944681ffa6ecd6208f
@@ -0,0 +1,2 @@
# The following has been generated automatically from src/core/qgsrelation.h
QgsRelation.RelationStrength.baseClass = QgsRelation
@@ -26,7 +26,6 @@ class QgsRelation
{
Association,
Composition

};


@@ -126,14 +126,7 @@ void QgsRelation::writeXml( QDomNode &node, QDomDocument &doc ) const
elem.setAttribute( QStringLiteral( "name" ), d->mRelationName );
elem.setAttribute( QStringLiteral( "referencingLayer" ), d->mReferencingLayerId );
elem.setAttribute( QStringLiteral( "referencedLayer" ), d->mReferencedLayerId );
if ( d->mRelationStrength == RelationStrength::Composition )
{
elem.setAttribute( QStringLiteral( "strength" ), QStringLiteral( "Composition" ) );
}
else
{
elem.setAttribute( QStringLiteral( "strength" ), QStringLiteral( "Association" ) );
}
elem.setAttribute( QStringLiteral( "strength" ), qgsEnumValueToKey<RelationStrength>( d->mRelationStrength ) );

for ( const FieldPair &pair : qgis::as_const( d->mFieldPairs ) )
{
@@ -58,8 +58,8 @@ class CORE_EXPORT QgsRelation
{
Association, //!< Loose relation, related elements are not part of the parent and a parent copy will not copy any children.
Composition //!< Fix relation, related elements are part of the parent and a parent copy will copy any children or delete of parent will delete children

};
Q_ENUM( RelationStrength )

#ifndef SIP_RUN

0 comments on commit e87ba45

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