32class QgsRelationPrivate;
45 Q_PROPERTY( QString
id READ
id WRITE
setId )
86 bool operator==(
const FieldPair &other )
const {
return first == other.first && second == other.second; }
134 void writeXml( QDomNode &node, QDomDocument &doc )
const;
139 void setId(
const QString &
id );
169 Q_INVOKABLE
void addFieldPair(
const QString &referencingField,
const QString &referencedField );
253 QString
name()
const;
312 QList< QgsRelation::FieldPair >
fieldPairs()
const;
316 const QList< QgsRelation::FieldPair > &pairs = sipCpp->fieldPairs();
317 sipRes =
new QMap< QString, QString >();
320 sipRes->insert( pair.first, pair.second );
345 bool referencingFieldsAllowNull()
const;
355 bool isValid()
const;
365 QString validationError()
const;
373 bool hasEqualDefinition(
const QgsRelation &other )
const;
379 Q_INVOKABLE QString resolveReferencedField(
const QString &referencingField )
const;
385 Q_INVOKABLE QString resolveReferencingField(
const QString &referencedField )
const;
393 void updateRelationStatus();
399 void setPolymorphicRelationId(
const QString &polymorphicRelationId );
405 QString polymorphicRelationId()
const;
435 mutable QExplicitlySharedDataPointer<QgsRelationPrivate> d;
Provides global constants and enumerations for use throughout the application.
RelationshipStrength
Relationship strength.
RelationshipType
Relationship types.
RelationshipCardinality
Relationship cardinality.
Wrapper for iterator of features from vector data provider or vector layer.
Wraps a request for features to a vector layer (or directly its vector data provider).
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
A relation where the referenced (parent) layer is calculated based on fields from the referencing (ch...
A container for the context for various read/write operations on 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.
Represents a relationship between two vector layers.
QgsFeatureRequest getReferencedFeatureRequest(const QgsAttributes &attributes) const
Creates a request to return the feature on the referenced (parent) layer which is referenced by the p...
QList< int > referencedFields
Q_INVOKABLE QgsFeature getReferencedFeature(const QgsFeature &feature) const
Creates a request to return the feature on the referenced (parent) layer which is referenced by the p...
void setId(const QString &id)
Set an id for this relation.
QgsFeatureIterator getRelatedFeatures(const QgsFeature &feature) const
Creates an iterator which returns all the features on the referencing (child) layer which have a fore...
QgsRelation()
Default constructor.
void setReferencedLayer(const QString &id)
Set the referenced (parent) layer id.
void setPolymorphicRelationId(const QString &polymorphicRelationId)
Sets the parent polymorphic relation id.
QgsRelation & operator=(const QgsRelation &other)
Copies a relation.
void generateId()
Generate a (project-wide) unique id for this relation.
static QgsRelation createFromXml(const QDomNode &node, QgsReadWriteContext &context, const QgsRelationContext &relationContext=QgsRelationContext())
Creates a relation from an XML structure.
QString polymorphicRelationId
QgsVectorLayer * referencedLayer
void setStrength(Qgis::RelationshipStrength strength)
Set a strength for this relation.
Q_INVOKABLE void addFieldPair(const QString &referencingField, const QString &referencedField)
Add a field pair which is part of this relation The first element of each pair are the field names of...
void setReferencingLayer(const QString &id)
Set the referencing (child) layer id.
QList< QgsRelation::FieldPair > fieldPairs() const
Returns the field pairs which form this relation The first element of each pair are the field names o...
QString referencedLayerId
QgsPolymorphicRelation polymorphicRelation
Qgis::RelationshipStrength strength
QgsVectorLayer * referencingLayer
QString referencingLayerId
void setName(const QString &name)
Set a name for this relation.
void writeXml(QDomNode &node, QDomDocument &doc) const
Writes a relation to an XML structure.
Q_INVOKABLE QString getRelatedFeaturesFilter(const QgsFeature &feature) const
Returns a filter expression which returns all the features on the referencing (child) layer which hav...
QList< int > referencingFields
QgsFeatureRequest getRelatedFeaturesRequest(const QgsFeature &feature) const
Creates a request to return all the features on the referencing (child) layer which have a foreign ke...
Represents a vector layer which manages a vector based dataset.
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
QList< int > QgsAttributeList