QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
#include <qgsvectorlayerjoininfo.h>
Public Member Functions | |
QgsVectorLayerJoinInfo ()=default | |
Constructor for QgsVectorLayerJoinInfo. More... | |
QgsFeature | extractJoinedFeature (const QgsFeature &feature) const |
Extract the join feature from the target feature for the current join layer information. More... | |
bool | hasCascadedDelete () const |
Returns whether a feature deleted on the target layer has to impact the joined layer by deleting the corresponding joined feature. More... | |
bool | hasSubset (bool blocklisted=true) const |
Returns true if blocklisted fields is not empty or if a subset of names has been set. More... | |
bool | hasUpsertOnEdit () const |
Returns whether a feature created on the target layer has to impact the joined layer by creating a new feature if necessary. More... | |
bool | isDynamicFormEnabled () const |
Returns whether the form has to be dynamically updated with joined fields when a feature is being created in the target layer. More... | |
bool | isEditable () const |
Returns whether joined fields may be edited through the form of the target layer. More... | |
bool | isUsingMemoryCache () const |
Returns whether values from the joined layer should be cached in memory to speed up lookups. More... | |
QString | joinFieldName () const |
Returns name of the field of joined layer that will be used for join. More... | |
Q_DECL_DEPRECATED QStringList | joinFieldNamesBlackList () const |
Returns the list of fields to ignore. More... | |
QStringList | joinFieldNamesBlockList () const |
Returns the list of fields to ignore. More... | |
QStringList * | joinFieldNamesSubset () const |
Returns the subset of fields to be used from joined layer. More... | |
QgsVectorLayer * | joinLayer () const |
Returns joined layer (may be nullptr if the reference was set by layer ID and not resolved yet) More... | |
QString | joinLayerId () const |
ID of the joined layer - may be used to resolve reference to the joined layer. More... | |
bool | operator== (const QgsVectorLayerJoinInfo &other) const |
QString | prefix () const |
Returns prefix of fields from the joined layer. If nullptr , joined layer's name will be used. More... | |
QString | prefixedFieldName (const QgsField &field) const |
Returns the prefixed name of the field. More... | |
void | setCascadedDelete (bool enabled) |
Sets whether a feature deleted on the target layer has to impact the joined layer by deleting the corresponding joined feature. More... | |
void | setDynamicFormEnabled (bool enabled) |
Sets whether the form has to be dynamically updated with joined fields when a feature is being created in the target layer. More... | |
void | setEditable (bool enabled) |
Sets whether the form of the target layer allows editing joined fields. More... | |
void | setJoinFieldName (const QString &fieldName) |
Sets name of the field of joined layer that will be used for join. More... | |
Q_DECL_DEPRECATED void | setJoinFieldNamesBlackList (const QStringList &blackList) |
Sets a list of fields to ignore whatever happens. More... | |
void | setJoinFieldNamesBlockList (const QStringList &list) |
Sets a list of fields to ignore whatever happens. More... | |
void | setJoinFieldNamesSubset (QStringList *fieldNamesSubset) |
Sets the subset of fields to be used from joined layer. More... | |
void | setJoinLayer (QgsVectorLayer *layer) |
Sets weak reference to the joined layer. More... | |
void | setJoinLayerId (const QString &layerId) |
Sets ID of the joined layer. It will need to be overwritten by setJoinLayer() to a reference to real layer. More... | |
void | setPrefix (const QString &prefix) |
Sets prefix of fields from the joined layer. If nullptr , joined layer's name will be used. More... | |
void | setTargetFieldName (const QString &fieldName) |
Sets name of the field of our layer that will be used for join. More... | |
void | setUpsertOnEdit (bool enabled) |
Sets whether a feature created on the target layer has to impact the joined layer by creating a new feature if necessary. More... | |
void | setUsingMemoryCache (bool enabled) |
Sets whether values from the joined layer should be cached in memory to speed up lookups. More... | |
QString | targetFieldName () const |
Returns name of the field of our layer that will be used for join. More... | |
Static Public Member Functions | |
static QStringList | joinFieldNamesSubset (const QgsVectorLayerJoinInfo &info, bool blocklisted=true) |
Returns the list of field names to use for joining considering blocklisted fields and subset. More... | |
Protected Attributes | |
QHash< QString, QgsAttributes > | cachedAttributes |
Cache for joined attributes to provide fast lookup (size is 0 if no memory caching) More... | |
bool | cacheDirty = true |
True if the cached join attributes need to be updated. More... | |
QStringList | mBlockList |
bool | mCascadedDelete = false |
bool | mDynamicForm = false |
bool | mEditable = false |
QString | mJoinFieldName |
Join field in the source layer. More... | |
std::shared_ptr< QStringList > | mJoinFieldsSubset |
Subset of fields to use from joined layer. nullptr = use all fields. More... | |
QgsVectorLayerRef | mJoinLayerRef |
Weak reference to the joined layer. More... | |
bool | mMemoryCache = false |
True if the join is cached in virtual memory. More... | |
QString | mPrefix |
An optional prefix. More... | |
QString | mTargetFieldName |
Join field in the target layer. More... | |
bool | mUpsertOnEdit = false |
Friends | |
class | QgsVectorLayerFeatureIterator |
class | QgsVectorLayerJoinBuffer |
Defines left outer join from our vector layer to some other vector layer. The join is done based on [our layer].targetField = [join layer].joinField
Definition at line 33 of file qgsvectorlayerjoininfo.h.
|
default |
Constructor for QgsVectorLayerJoinInfo.
QgsFeature QgsVectorLayerJoinInfo::extractJoinedFeature | ( | const QgsFeature & | feature | ) | const |
Extract the join feature from the target feature for the current join layer information.
feature | A feature from the target layer |
Definition at line 62 of file qgsvectorlayerjoininfo.cpp.
|
inline |
Returns whether a feature deleted on the target layer has to impact the joined layer by deleting the corresponding joined feature.
Definition at line 135 of file qgsvectorlayerjoininfo.h.
bool QgsVectorLayerJoinInfo::hasSubset | ( | bool | blocklisted = true | ) | const |
Returns true
if blocklisted fields is not empty or if a subset of names has been set.
Definition at line 123 of file qgsvectorlayerjoininfo.cpp.
|
inline |
Returns whether a feature created on the target layer has to impact the joined layer by creating a new feature if necessary.
Definition at line 121 of file qgsvectorlayerjoininfo.h.
|
inline |
Returns whether the form has to be dynamically updated with joined fields when a feature is being created in the target layer.
Definition at line 94 of file qgsvectorlayerjoininfo.h.
|
inline |
Returns whether joined fields may be edited through the form of the target layer.
Definition at line 108 of file qgsvectorlayerjoininfo.h.
bool QgsVectorLayerJoinInfo::isUsingMemoryCache | ( | ) | const |
Returns whether values from the joined layer should be cached in memory to speed up lookups.
Will return false if upsertOnEdit is enabled.
Definition at line 43 of file qgsvectorlayerjoininfo.cpp.
|
inline |
Returns name of the field of joined layer that will be used for join.
Definition at line 73 of file qgsvectorlayerjoininfo.h.
|
inline |
Returns the list of fields to ignore.
Definition at line 173 of file qgsvectorlayerjoininfo.h.
|
inline |
Returns the list of fields to ignore.
Definition at line 189 of file qgsvectorlayerjoininfo.h.
|
inline |
Returns the subset of fields to be used from joined layer.
All fields will be used if nullptr
is returned.
Definition at line 236 of file qgsvectorlayerjoininfo.h.
|
static |
Returns the list of field names to use for joining considering blocklisted fields and subset.
Definition at line 86 of file qgsvectorlayerjoininfo.cpp.
|
inline |
Returns joined layer (may be nullptr
if the reference was set by layer ID and not resolved yet)
Definition at line 58 of file qgsvectorlayerjoininfo.h.
|
inline |
ID of the joined layer - may be used to resolve reference to the joined layer.
Definition at line 63 of file qgsvectorlayerjoininfo.h.
|
inline |
Definition at line 207 of file qgsvectorlayerjoininfo.h.
|
inline |
Returns prefix of fields from the joined layer. If nullptr
, joined layer's name will be used.
Definition at line 78 of file qgsvectorlayerjoininfo.h.
QString QgsVectorLayerJoinInfo::prefixedFieldName | ( | const QgsField & | field | ) | const |
Returns the prefixed name of the field.
field | the field |
Definition at line 21 of file qgsvectorlayerjoininfo.cpp.
|
inline |
Sets whether a feature deleted on the target layer has to impact the joined layer by deleting the corresponding joined feature.
Definition at line 142 of file qgsvectorlayerjoininfo.h.
|
inline |
Sets whether the form has to be dynamically updated with joined fields when a feature is being created in the target layer.
Definition at line 101 of file qgsvectorlayerjoininfo.h.
void QgsVectorLayerJoinInfo::setEditable | ( | bool | enabled | ) |
Sets whether the form of the target layer allows editing joined fields.
Definition at line 51 of file qgsvectorlayerjoininfo.cpp.
|
inline |
Sets name of the field of joined layer that will be used for join.
Definition at line 71 of file qgsvectorlayerjoininfo.h.
|
inline |
Sets a list of fields to ignore whatever happens.
Definition at line 166 of file qgsvectorlayerjoininfo.h.
|
inline |
Sets a list of fields to ignore whatever happens.
Definition at line 181 of file qgsvectorlayerjoininfo.h.
|
inline |
Sets the subset of fields to be used from joined layer.
Ownership of fileNamesSubset is transferred. A fieldNameSubset of nullptr
indicates that all fields should be used.
Definition at line 225 of file qgsvectorlayerjoininfo.h.
|
inline |
Sets weak reference to the joined layer.
Definition at line 56 of file qgsvectorlayerjoininfo.h.
|
inline |
Sets ID of the joined layer. It will need to be overwritten by setJoinLayer() to a reference to real layer.
Definition at line 61 of file qgsvectorlayerjoininfo.h.
|
inline |
Sets prefix of fields from the joined layer. If nullptr
, joined layer's name will be used.
Definition at line 76 of file qgsvectorlayerjoininfo.h.
|
inline |
Sets name of the field of our layer that will be used for join.
Definition at line 66 of file qgsvectorlayerjoininfo.h.
|
inline |
Sets whether a feature created on the target layer has to impact the joined layer by creating a new feature if necessary.
Definition at line 128 of file qgsvectorlayerjoininfo.h.
void QgsVectorLayerJoinInfo::setUsingMemoryCache | ( | bool | enabled | ) |
Sets whether values from the joined layer should be cached in memory to speed up lookups.
Definition at line 38 of file qgsvectorlayerjoininfo.cpp.
|
inline |
Returns name of the field of our layer that will be used for join.
Definition at line 68 of file qgsvectorlayerjoininfo.h.
|
friend |
Definition at line 261 of file qgsvectorlayerjoininfo.h.
|
friend |
Definition at line 260 of file qgsvectorlayerjoininfo.h.
|
protected |
Cache for joined attributes to provide fast lookup (size is 0 if no memory caching)
Definition at line 277 of file qgsvectorlayerjoininfo.h.
|
protected |
True if the cached join attributes need to be updated.
Definition at line 264 of file qgsvectorlayerjoininfo.h.
|
protected |
Definition at line 274 of file qgsvectorlayerjoininfo.h.
|
protected |
Definition at line 272 of file qgsvectorlayerjoininfo.h.
|
protected |
Definition at line 266 of file qgsvectorlayerjoininfo.h.
|
protected |
Definition at line 268 of file qgsvectorlayerjoininfo.h.
|
protected |
Join field in the source layer.
Definition at line 244 of file qgsvectorlayerjoininfo.h.
|
protected |
Subset of fields to use from joined layer. nullptr
= use all fields.
Definition at line 256 of file qgsvectorlayerjoininfo.h.
|
protected |
Weak reference to the joined layer.
Definition at line 242 of file qgsvectorlayerjoininfo.h.
|
protected |
True if the join is cached in virtual memory.
Definition at line 253 of file qgsvectorlayerjoininfo.h.
|
protected |
An optional prefix.
If it is a Null string "{layername}_" will be used
Definition at line 250 of file qgsvectorlayerjoininfo.h.
|
protected |
Join field in the target layer.
Definition at line 240 of file qgsvectorlayerjoininfo.h.
|
protected |
Definition at line 270 of file qgsvectorlayerjoininfo.h.