QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
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;
QgsRelation::RelationStrength strength() const
Returns the strength of the relation.
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 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...
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...
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.
void setStrength(RelationStrength strength)
Set a strength for this relation.
void setReferencingLayer(const QString &id)
Set the referencing (child) layer id.
void setName(const QString &name)
Set a name for this relation.
void setId(const QString &id)
Set an id for this relation.
QList< QgsRelation::FieldPair > fieldPairs() const
Returns the list of field pairs.
QString id() const
Returns the layer's unique ID, which is used to access this layer from QgsProject.
QgsVectorLayerRef referencingLayer() const
Returns a weak reference to the referencing layer.
MatchType
Flag for match type in weak resolution.
QgsVectorLayerRef referencedLayer() const
Returns a weak reference to the referenced layer.
void setReferencedLayer(const QString &id)
Set the referenced (parent) layer id.
RelationStrength
enum for the relation strength Association, Composition