Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add consistency between ptrs and ref
  • Loading branch information
pblottiere committed Jul 2, 2017
1 parent 53d70d2 commit 3e2d9c5
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion python/core/qgsvectorlayerjoinbuffer.sip
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/core/qgsvectorlayerjoinbuffer.cpp
Expand Up @@ -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 );
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvectorlayerjoinbuffer.h
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/gui/qgsattributeform.cpp
Expand Up @@ -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;
}
Expand All @@ -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 )
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsattributeform.h
Expand Up @@ -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 );

Expand Down

0 comments on commit 3e2d9c5

Please sign in to comment.