23 #include "qgis_core.h" 42 Q_PROPERTY( QString
id READ
id WRITE setId )
45 Q_PROPERTY( QString name READ name WRITE setName )
46 Q_PROPERTY(
bool isValid READ isValid )
79 FieldPair(
const QString &referencingField,
const QString &referencedField )
80 : QPair< QString, QString >( referencingField, referencedField ) {}
87 bool operator==(
const FieldPair &other )
const {
return first == other.first && second == other.second; }
103 static QgsRelation createFromXml(
const QDomNode &node );
111 void writeXml( QDomNode &node, QDomDocument &doc )
const;
116 void setId(
const QString &
id );
121 void setName(
const QString &name );
132 void setReferencingLayer(
const QString &
id );
137 void setReferencedLayer(
const QString &
id );
147 void addFieldPair(
const QString &referencingField,
const QString &referencedField );
192 QString getRelatedFeaturesFilter(
const QgsFeature &feature )
const;
231 QString name()
const;
260 QString referencingLayerId()
const;
275 QString referencedLayerId()
const;
292 QList< QgsRelation::FieldPair > fieldPairs()
const;
294 QMap< QString, QString > fieldPairs()
const;
296 const QList< QgsRelation::FieldPair > &pairs = sipCpp->fieldPairs();
297 sipRes =
new QMap< QString, QString >();
300 sipRes->insert( pair.first, pair.second );
326 bool isValid()
const;
335 bool hasEqualDefinition(
const QgsRelation &other )
const;
342 Q_INVOKABLE QString resolveReferencedField(
const QString &referencingField )
const;
349 Q_INVOKABLE QString resolveReferencingField(
const QString &referencedField )
const;
357 void updateRelationStatus();
362 QString mRelationName;
364 QString mReferencingLayerId;
368 QString mReferencedLayerId;
379 QList< FieldPair > mFieldPairs;
388 #endif // QGSRELATION_H Wrapper for iterator of features from vector data provider or vector layer.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Q_DECLARE_METATYPE(QModelIndex)
Loose relation, related elements are not part of the parent and a parent copy will not copy any child...
Defines a relation between matching fields of the two involved tables of a relation.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
bool operator==(const FieldPair &other) const
RelationStrength
enum for the relation strength Association, Composition
QString referencedField() const
Gets the name of the referenced (parent) field.
FieldPair(const QString &referencingField, const QString &referencedField)
Constructor which takes two fields.
QList< int > QgsAttributeList
Represents a vector layer which manages a vector based data sets.
QString referencingField() const
Gets the name of the referencing (child) field.