16#ifndef QGSWEAKRELATION_H
17#define QGSWEAKRELATION_H
69 const QString &relationName,
71 const QString &referencingLayerId,
72 const QString &referencingLayerName,
73 const QString &referencingLayerSource,
74 const QString &referencingLayerProviderKey,
75 const QString &referencedLayerId,
76 const QString &referencedLayerName,
77 const QString &referencedLayerSource,
78 const QString &referencedLayerProviderKey
92 QList< QgsRelation > resolvedRelations(
const QgsProject *project )
const;
100 QString
id()
const {
return mRelationId; }
107 QString
name()
const {
return mRelationName; }
121 QString referencingLayerSource() const;
128 QString referencingLayerProvider() const;
138 QString referencingLayerName() const;
152 QString referencedLayerSource() const;
159 QString referencedLayerProvider() const;
169 QString referencedLayerName() const;
194 QString mappingTableSource() const;
201 QString mappingTableProvider() const;
211 QString mappingTableName() const;
218 QStringList referencingLayerFields()
const {
return mReferencingLayerFields; }
421 static void writeXml(
const QgsVectorLayer *layer, WeakRelationType type,
const QgsRelation &relation, QDomNode &node, QDomDocument &doc );
424 SIP_PYOBJECT __repr__();
427 QString leftIdentifier;
428 if ( !sipCpp->referencedLayer().source.isEmpty() )
429 leftIdentifier = sipCpp->referencedLayer().source;
431 QString rightIdentifier;
432 if ( !sipCpp->referencingLayer().source.isEmpty() )
433 rightIdentifier = sipCpp->referencingLayer().source;
436 if ( leftIdentifier.isEmpty() && rightIdentifier.isEmpty() )
437 str = QStringLiteral(
"<QgsWeakRelation: %1>" ).arg( sipCpp->id() );
439 str = QStringLiteral(
"<QgsWeakRelation: %1 - %2 -> %3>" ).arg( sipCpp->id(), leftIdentifier, rightIdentifier );
441 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
452 QString mRelationName;
455 QStringList mReferencingLayerFields;
456 QStringList mMappingReferencingLayerFields;
457 QStringList mReferencedLayerFields;
458 QStringList mMappingReferencedLayerFields;
461 QString mForwardPathLabel;
462 QString mBackwardPathLabel;
463 QString mRelatedTableType;
465 friend class TestQgsWeakRelation;
RelationshipStrength
Relationship strength.
@ Association
Loose relation, related elements are not part of the parent and a parent copy will not copy any child...
RelationshipCardinality
Relationship cardinality.
@ OneToMany
One to many relationship.
Resolves relative paths into absolute paths and vice versa.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Represents a vector layer which manages a vector based data sets.
The QgsWeakRelation class represent a QgsRelation with possibly unresolved layers or unmatched fields...
WeakRelationType
Enum to distinguish if the layer is referenced or referencing.
@ Referencing
The layer is referencing (or the "child" / "right" layer in the relationship)
QStringList mappingReferencingLayerFields() const
Returns the list of fields from the mappingTable() involved in the relationship.
void setForwardPathLabel(const QString &label)
Sets the label of the forward path for the relationship.
QgsWeakRelation()
Default constructor for an invalid relation.
void setMappingReferencingLayerFields(const QStringList &fields)
Sets the list of fields from the mappingTable() involved in the relationship.
void setBackwardPathLabel(const QString &label)
Sets the label of the backward path for the relationship.
QString relatedTableType() const
Returns the type string of the related table.
void setReferencingLayerFields(const QStringList &fields)
Sets the list of fields from the referencingLayer() involved in the relationship.
QString name() const
Returns the relationship's name.
QString backwardPathLabel() const
Returns the label of the backward path for the relationship.
void setMappingReferencedLayerFields(const QStringList &fields)
Sets the list of fields from the mappingTable() involved in the relationship.
QString id() const
Returns the relationship's ID.
QString forwardPathLabel() const
Returns the label of the forward path for the relationship.
Qgis::RelationshipCardinality cardinality() const
Returns the relationship's cardinality.
void setCardinality(Qgis::RelationshipCardinality cardinality)
Sets the relationship's cardinality.
QStringList referencedLayerFields() const
Returns the list of fields from the referencedLayer() involved in the relationship.
QStringList mappingReferencedLayerFields() const
Returns the list of fields from the mappingTable() involved in the relationship.
void setRelatedTableType(const QString &type)
Sets the type string of the related table.
void setReferencedLayerFields(const QStringList &fields)
Sets the list of fields from the referencedLayer() involved in the relationship.
MatchType
Flag for match type in weak resolution.