Skip to content
Permalink
Browse files

Add consistency between ptrs and ref

  • Loading branch information
pblottiere committed Jul 2, 2017
1 parent 53d70d2 commit 3e2d9c544554ab21987dcd0c77b4cb918c92d309
@@ -108,7 +108,7 @@ Quick way to test if there is any join at all
:rtype: list of const QgsVectorLayerJoinInfo
%End

QgsFeature joinedFeatureOf( const QgsVectorLayerJoinInfo &info, const QgsFeature &feature ) const;
QgsFeature joinedFeatureOf( const QgsVectorLayerJoinInfo *info, const QgsFeature &feature ) const;
%Docstring
Returns the joined feature corresponding to the feature.
\param info the vector join information
@@ -412,22 +412,22 @@ QList<const QgsVectorLayerJoinInfo *> QgsVectorLayerJoinBuffer::joinsWhereFieldI
return infos;
}

QgsFeature QgsVectorLayerJoinBuffer::joinedFeatureOf( const QgsVectorLayerJoinInfo &info, const QgsFeature &feature ) const
QgsFeature QgsVectorLayerJoinBuffer::joinedFeatureOf( const QgsVectorLayerJoinInfo *info, const QgsFeature &feature ) const
{
QgsFeature joinedFeature;

if ( info.joinLayer() )
if ( info->joinLayer() )
{
const QVariant targetValue = feature.attribute( info.targetFieldName() );
QString fieldRef = QgsExpression::quotedColumnRef( info.joinFieldName() );
const QVariant targetValue = feature.attribute( info->targetFieldName() );
QString fieldRef = QgsExpression::quotedColumnRef( info->joinFieldName() );
QString quotedVal = QgsExpression::quotedValue( targetValue.toString() );
const QString filter = QString( "%1 = %2" ).arg( fieldRef, quotedVal );

QgsFeatureRequest request;
request.setFilterExpression( filter );
request.setLimit( 1 );

QgsFeatureIterator it = info.joinLayer()->getFeatures( request );
QgsFeatureIterator it = info->joinLayer()->getFeatures( request );
it.nextFeature( joinedFeature );
}

@@ -96,7 +96,7 @@ class CORE_EXPORT QgsVectorLayerJoinBuffer : public QObject
* \param feature the feature of the target layer
* \since QGIS 3.0
*/
QgsFeature joinedFeatureOf( const QgsVectorLayerJoinInfo &info, const QgsFeature &feature ) const;
QgsFeature joinedFeatureOf( const QgsVectorLayerJoinInfo *info, const QgsFeature &feature ) const;

//! Create a copy of the join buffer
//! \since QGIS 2.6
@@ -1936,12 +1936,12 @@ void QgsAttributeForm::ContainerInformation::apply( QgsExpressionContext *expres
}
}

QgsFeature QgsAttributeForm::joinedFeature( const QgsVectorLayerJoinInfo &info, const QgsFeature &feature ) const
QgsFeature QgsAttributeForm::joinedFeature( const QgsVectorLayerJoinInfo *info, const QgsFeature &feature ) const
{
QgsFeature joinedFeature = mLayer->joinBuffer()->joinedFeatureOf( info, feature );

if ( !joinedFeature.isValid() )
joinedFeature = QgsVectorLayerUtils::createFeature( info.joinLayer(), QgsGeometry(), QgsAttributeMap() );
joinedFeature = QgsVectorLayerUtils::createFeature( info->joinLayer(), QgsGeometry(), QgsAttributeMap() );

return joinedFeature;
}
@@ -1960,7 +1960,7 @@ void QgsAttributeForm::updateJoinedFields( const QgsEditorWidgetWrapper &eww )
if ( !info->isDynamicFormEnabled() )
continue;

QgsFeature joinFeature = joinedFeature( *info, formFeature );
QgsFeature joinFeature = joinedFeature( info, formFeature );

QStringList *subsetFields = info->joinFieldNamesSubset();
if ( subsetFields )
@@ -273,7 +273,7 @@ class GUI_EXPORT QgsAttributeForm : public QWidget

void initPython();

QgsFeature joinedFeature( const QgsVectorLayerJoinInfo &info, const QgsFeature &feature ) const;
QgsFeature joinedFeature( const QgsVectorLayerJoinInfo *info, const QgsFeature &feature ) const;

void updateJoinedFields( const QgsEditorWidgetWrapper &eww );

0 comments on commit 3e2d9c5

Please sign in to comment.
You can’t perform that action at this time.