23 #include "qgis_core.h"
35 class QgsRelationPrivate;
46 Q_PROPERTY( QString
id READ
id WRITE setId )
47 Q_PROPERTY(
QgsVectorLayer *referencingLayer READ referencingLayer )
49 Q_PROPERTY( QString name READ name WRITE setName )
50 Q_PROPERTY(
bool isValid READ isValid )
51 Q_PROPERTY( QString polymorphicRelationId READ polymorphicRelationId WRITE setPolymorphicRelationId )
64 Q_ENUM( RelationType )
75 Q_ENUM( RelationStrength )
95 FieldPair(
const QString &referencingField,
const QString &referencedField )
96 : QPair< QString, QString >( referencingField, referencedField ) {}
103 bool operator==(
const FieldPair &other )
const {
return first == other.first && second == other.second; }
149 void writeXml( QDomNode &node, QDomDocument &doc )
const;
154 void setId(
const QString &
id );
159 void setName(
const QString &name );
170 void setReferencingLayer(
const QString &
id );
175 void setReferencedLayer(
const QString &
id );
185 void addFieldPair(
const QString &referencingField,
const QString &referencedField );
230 QString getRelatedFeaturesFilter(
const QgsFeature &feature )
const;
269 QString name()
const;
298 QString referencingLayerId()
const;
313 QString referencedLayerId()
const;
330 QList< QgsRelation::FieldPair > fieldPairs()
const;
332 QMap< QString, QString > fieldPairs()
const;
334 const QList< QgsRelation::FieldPair > &pairs = sipCpp->fieldPairs();
335 sipRes =
new QMap< QString, QString >();
338 sipRes->insert( pair.first, pair.second );
365 bool isValid()
const;
374 bool hasEqualDefinition(
const QgsRelation &other )
const;
381 Q_INVOKABLE QString resolveReferencedField(
const QString &referencingField )
const;
388 Q_INVOKABLE QString resolveReferencingField(
const QString &referencedField )
const;
396 void updateRelationStatus();
402 void setPolymorphicRelationId(
const QString &polymorphicRelationId );
408 QString polymorphicRelationId()
const;
420 RelationType type()
const;
424 mutable QExplicitlySharedDataPointer<QgsRelationPrivate> d;
Wrapper for iterator of features from vector data provider or vector layer.
This class wraps a request for features to a vector layer (or directly its vector data provider).
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
A polymorphic relation consists of the same properties like a normal relation except for the referenc...
The class is used as a container of context for various read/write operations on other objects.
Defines a relation between matching fields of the two involved tables of a relation.
QString referencingField() const
Gets the name of the referencing (child) field.
QString referencedField() const
Gets the name of the referenced (parent) field.
FieldPair(const QString &referencingField, const QString &referencedField)
Constructor which takes two fields.
bool operator==(const FieldPair &other) const
FieldPair()=default
Default constructor: NULL strings.
RelationType
Enum holding the relations type.
@ Generated
A generated relation is a child of a polymorphic relation.
@ Normal
A normal relation.
RelationStrength
enum for the relation strength Association, Composition
@ Association
Loose relation, related elements are not part of the parent and a parent copy will not copy any child...
Represents a vector layer which manages a vector based data sets.
QList< int > QgsAttributeList
Q_DECLARE_METATYPE(QgsMeshTimeSettings)