20                                   const QString &referencingLayerId, 
const QString &referencingLayerName, 
const QString &referencingLayerSource, 
const QString &referencingLayerProviderKey,
    21                                   const QString &referencedLayerId, 
const QString &referencedLayerName, 
const QString &referencedLayerSource, 
const QString &referencedLayerProviderKey,
    22                                   const QList<QgsRelation::FieldPair> &fieldPairs )
    23   : mReferencingLayer( referencingLayerId, referencingLayerName, referencingLayerSource, referencingLayerProviderKey )
    24   , mReferencedLayer( referencedLayerId, referencedLayerName, referencedLayerSource, referencedLayerProviderKey )
    25   , mRelationId( relationId )
    26   , mRelationName( relationName )
    27   , mStrength( strength )
    28   , mFieldPairs( fieldPairs )
    35   relation.
setId( mRelationId );
    36   relation.
setName( mRelationName );
    50   for ( 
const auto &fp : qgis::as_const( mFieldPairs ) )
    59   return mReferencingLayer;
    64   return mReferencedLayer;
 Base class for all map layer types. 
 
QgsRelation::RelationStrength strength() const
Returns the strength of the relation. 
 
QgsRelation resolvedRelation(const QgsProject *project, QgsVectorLayerRef::MatchType matchType=QgsVectorLayerRef::MatchType::All) const
Resolves a weak relation in the given project returning a possibly invalid QgsRelation and without pe...
 
TYPE * resolveWeakly(const QgsProject *project, MatchType matchType=MatchType::All)
Resolves the map layer by attempting to find a matching layer in a project using a weak match...
 
void setReferencingLayer(const QString &id)
Set the referencing (child) layer id. 
 
void addFieldPair(const QString &referencingField, const QString &referencedField)
Add a field pairs which is part of this relation The first element of each pair are the field names o...
 
void setName(const QString &name)
Set a name for this relation. 
 
QgsWeakRelation(const QString &relationId, const QString &relationName, const QgsRelation::RelationStrength strength, const QString &referencingLayerId, const QString &referencingLayerName, const QString &referencingLayerSource, const QString &referencingLayerProviderKey, const QString &referencedLayerId, const QString &referencedLayerName, const QString &referencedLayerSource, const QString &referencedLayerProviderKey, const QList< QgsRelation::FieldPair > &fieldPairs)
Creates a QgsWeakRelation. 
 
QgsVectorLayerRef referencingLayer() const
Returns a weak reference to the referencing layer. 
 
void setId(const QString &id)
Set an id for this relation. 
 
void setStrength(RelationStrength strength)
Set a strength for this relation. 
 
QString id() const
Returns the layer's unique ID, which is used to access this layer from QgsProject. 
 
Encapsulates a QGIS project, including sets of map layers and their styles, layouts, annotations, canvases, etc. 
 
MatchType
Flag for match type in weak resolution. 
 
void setReferencedLayer(const QString &id)
Set the referenced (parent) layer id. 
 
RelationStrength
enum for the relation strength Association, Composition 
 
QList< QgsRelation::FieldPair > fieldPairs() const
Returns the list of field pairs. 
 
QgsVectorLayerRef referencedLayer() const
Returns a weak reference to the referenced layer.