QGIS API Documentation  3.14.0-Pi (9f7028fd23)
Public Member Functions | Friends | List of all members
QgsWeakRelation Class Reference

The QgsWeakRelation class represent a QgsRelation with possibly unresolved layers or unmatched fields. More...

#include <qgsweakrelation.h>

Public Member Functions

 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. More...
 
QList< QgsRelation::FieldPairfieldPairs () const
 Returns the list of field pairs. More...
 
QgsVectorLayerRef referencedLayer () const
 Returns a weak reference to the referenced layer. More...
 
QgsVectorLayerRef referencingLayer () const
 Returns a weak reference to the referencing layer. More...
 
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 performing any kind of validity check. More...
 
QgsRelation::RelationStrength strength () const
 Returns the strength of the relation. More...
 

Friends

class TestQgsWeakRelation
 

Detailed Description

The QgsWeakRelation class represent a QgsRelation with possibly unresolved layers or unmatched fields.

This class is used to store relation information attached to a layer style, a method to attempt relation resolution is also implemented and can be used to create a QgsRelation after the dependent layers are loaded and available.

Note
not available in Python bindings
Since
QGIS 3.12

Definition at line 38 of file qgsweakrelation.h.

Constructor & Destructor Documentation

◆ QgsWeakRelation()

QgsWeakRelation::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.

Definition at line 19 of file qgsweakrelation.cpp.

Member Function Documentation

◆ fieldPairs()

QList< QgsRelation::FieldPair > QgsWeakRelation::fieldPairs ( ) const

Returns the list of field pairs.

Definition at line 72 of file qgsweakrelation.cpp.

◆ referencedLayer()

QgsVectorLayerRef QgsWeakRelation::referencedLayer ( ) const

Returns a weak reference to the referenced layer.

Definition at line 62 of file qgsweakrelation.cpp.

◆ referencingLayer()

QgsVectorLayerRef QgsWeakRelation::referencingLayer ( ) const

Returns a weak reference to the referencing layer.

Definition at line 57 of file qgsweakrelation.cpp.

◆ resolvedRelation()

QgsRelation QgsWeakRelation::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 performing any kind of validity check.

Note
Client code should never assume that the returned relation is valid and the layer components are not NULL.

Definition at line 32 of file qgsweakrelation.cpp.

◆ strength()

QgsRelation::RelationStrength QgsWeakRelation::strength ( ) const

Returns the strength of the relation.

Definition at line 67 of file qgsweakrelation.cpp.

Friends And Related Function Documentation

◆ TestQgsWeakRelation

friend class TestQgsWeakRelation
friend

Definition at line 97 of file qgsweakrelation.h.


The documentation for this class was generated from the following files: