diff --git a/python/core/qgsvectorlayer.sip b/python/core/qgsvectorlayer.sip
index 1c59240ff24..62ccaa27e7e 100644
--- a/python/core/qgsvectorlayer.sip
+++ b/python/core/qgsvectorlayer.sip
@@ -1444,7 +1444,7 @@ class QgsVectorLayer : QgsMapLayer
      *
      * @see select(QgsFeatureIds)
      */
-    void select( const QgsFeatureId &featureId );
+    void select( QgsFeatureId featureId );
 
     /**
      * Select features by their ID
@@ -1661,7 +1661,7 @@ class QgsVectorLayer : QgsMapLayer
   private slots:
     void onRelationsLoaded();
     void onJoinedFieldsChanged();
-    void onFeatureDeleted( const QgsFeatureId& fid );
+    void onFeatureDeleted( QgsFeatureId fid );
 
   protected:
     /** Set the extent */
diff --git a/python/core/qgsvectorlayercache.sip b/python/core/qgsvectorlayercache.sip
index 8424b63ae31..647dd233d4d 100644
--- a/python/core/qgsvectorlayercache.sip
+++ b/python/core/qgsvectorlayercache.sip
@@ -179,7 +179,7 @@ class QgsVectorLayerCache : QObject
      * @brief Is emitted when an attribute is changed. Is re-emitted after the layer itself emits this signal.
      *        You should connect to this signal, to be sure, to not get a cached value if querying the cache.
      */
-    void attributeValueChanged( const QgsFeatureId& fid, const int& field, const QVariant &value );
+    void attributeValueChanged( QgsFeatureId fid, const int& field, const QVariant &value );
 
     /**
      * Is emitted, when a new feature has been added to the layer and this cache.
diff --git a/src/app/nodetool/qgsmaptoolnodetool.cpp b/src/app/nodetool/qgsmaptoolnodetool.cpp
index 0e17905acc7..a95d23bfa9d 100644
--- a/src/app/nodetool/qgsmaptoolnodetool.cpp
+++ b/src/app/nodetool/qgsmaptoolnodetool.cpp
@@ -165,7 +165,7 @@ void QgsMapToolNodeTool::canvasMoveEvent( QgsMapMouseEvent* e )
       double deltaX = curPos.x() - pressPos.x();
       double deltaY = curPos.y() - pressPos.y();
 
-      Q_FOREACH ( const QgsFeatureId& fid, mMoveRubberBands.keys() )
+      Q_FOREACH ( QgsFeatureId fid, mMoveRubberBands.keys() )
       {
         typedef QPair<QgsVertexId, QgsPointV2> MoveVertex;
         Q_FOREACH ( const MoveVertex& pair, mMoveVertices[fid] )
diff --git a/src/app/qgsmaptoollabel.cpp b/src/app/qgsmaptoollabel.cpp
index 6e991971e87..75a3c1d0629 100644
--- a/src/app/qgsmaptoollabel.cpp
+++ b/src/app/qgsmaptoollabel.cpp
@@ -458,7 +458,7 @@ int QgsMapToolLabel::dataDefinedColumnIndex( QgsPalLayerSettings::DataDefinedPro
   return -1;
 }
 
-bool QgsMapToolLabel::dataDefinedPosition( QgsVectorLayer* vlayer, const QgsFeatureId &featureId, double& x, bool& xSuccess, double& y, bool& ySuccess, int& xCol, int& yCol ) const
+bool QgsMapToolLabel::dataDefinedPosition( QgsVectorLayer* vlayer, QgsFeatureId featureId, double& x, bool& xSuccess, double& y, bool& ySuccess, int& xCol, int& yCol ) const
 {
   xSuccess = false;
   ySuccess = false;
@@ -513,7 +513,7 @@ bool QgsMapToolLabel::layerIsRotatable( QgsMapLayer* layer, int& rotationCol ) c
   return false;
 }
 
-bool QgsMapToolLabel::dataDefinedRotation( QgsVectorLayer* vlayer, const QgsFeatureId &featureId, double& rotation, bool& rotationSuccess, bool ignoreXY ) const
+bool QgsMapToolLabel::dataDefinedRotation( QgsVectorLayer* vlayer, QgsFeatureId featureId, double& rotation, bool& rotationSuccess, bool ignoreXY ) const
 {
   rotationSuccess = false;
   if ( !vlayer )
@@ -549,7 +549,7 @@ bool QgsMapToolLabel::dataDefinedRotation( QgsVectorLayer* vlayer, const QgsFeat
   return true;
 }
 
-bool QgsMapToolLabel::dataDefinedShowHide( QgsVectorLayer* vlayer, const QgsFeatureId &featureId, int& show, bool& showSuccess, int& showCol ) const
+bool QgsMapToolLabel::dataDefinedShowHide( QgsVectorLayer* vlayer, QgsFeatureId featureId, int& show, bool& showSuccess, int& showCol ) const
 {
   showSuccess = false;
   if ( !vlayer )
diff --git a/src/app/qgsmaptoollabel.h b/src/app/qgsmaptoollabel.h
index 8514c32fcf5..5dcbbc1f2b0 100644
--- a/src/app/qgsmaptoollabel.h
+++ b/src/app/qgsmaptoollabel.h
@@ -128,7 +128,7 @@ class APP_EXPORT QgsMapToolLabel: public QgsMapTool
       @param xCol out: index of the x position column
       @param yCol out: index of the y position column
       @return false if layer does not have data defined label position enabled*/
-    bool dataDefinedPosition( QgsVectorLayer* vlayer, const QgsFeatureId &featureId, double& x, bool& xSuccess, double& y, bool& ySuccess, int& xCol, int& yCol ) const;
+    bool dataDefinedPosition( QgsVectorLayer* vlayer, QgsFeatureId featureId, double& x, bool& xSuccess, double& y, bool& ySuccess, int& xCol, int& yCol ) const;
 
     /** Returns data defined rotation of a feature.
       @param vlayer vector layer
@@ -138,7 +138,7 @@ class APP_EXPORT QgsMapToolLabel: public QgsMapTool
       @param ignoreXY ignore that x and y are required to be data-defined
       @return true if data defined rotation is enabled on the layer
       */
-    bool dataDefinedRotation( QgsVectorLayer* vlayer, const QgsFeatureId &featureId, double& rotation, bool& rotationSuccess, bool ignoreXY = false ) const;
+    bool dataDefinedRotation( QgsVectorLayer* vlayer, QgsFeatureId featureId, double& rotation, bool& rotationSuccess, bool ignoreXY = false ) const;
 
     /** Returns data defined show/hide of a feature.
       @param vlayer vector layer
@@ -148,7 +148,7 @@ class APP_EXPORT QgsMapToolLabel: public QgsMapTool
       @param showCol out: index of the show label column
       @return true if data defined show/hide is enabled on the layer
       */
-    bool dataDefinedShowHide( QgsVectorLayer* vlayer, const QgsFeatureId &featureId, int& show, bool& showSuccess, int& showCol ) const;
+    bool dataDefinedShowHide( QgsVectorLayer* vlayer, QgsFeatureId featureId, int& show, bool& showSuccess, int& showCol ) const;
 
   private:
     QgsPalLayerSettings mInvalidLabelSettings;
diff --git a/src/app/qgsmaptoolshowhidelabels.cpp b/src/app/qgsmaptoolshowhidelabels.cpp
index 8eba2d057bd..ad018ac2ce9 100644
--- a/src/app/qgsmaptoolshowhidelabels.cpp
+++ b/src/app/qgsmaptoolshowhidelabels.cpp
@@ -152,7 +152,7 @@ void QgsMapToolShowHideLabels::showHideLabels( QMouseEvent * e )
   QString editTxt = doHide ? tr( "Hid labels" ) : tr( "Showed labels" );
 
   vlayer->beginEditCommand( editTxt );
-  Q_FOREACH ( const QgsFeatureId &fid, selectedFeatIds )
+  Q_FOREACH ( QgsFeatureId fid, selectedFeatIds )
   {
     if ( showHideLabel( vlayer, fid, doHide ) )
     {
@@ -261,7 +261,7 @@ bool QgsMapToolShowHideLabels::selectedLabelFeatures( QgsVectorLayer* vlayer,
 }
 
 bool QgsMapToolShowHideLabels::showHideLabel( QgsVectorLayer* vlayer,
-    const QgsFeatureId &fid,
+    QgsFeatureId fid,
     bool hide )
 {
 
diff --git a/src/app/qgsmaptoolshowhidelabels.h b/src/app/qgsmaptoolshowhidelabels.h
index fbb6c6b7e0c..8dea9632f52 100644
--- a/src/app/qgsmaptoolshowhidelabels.h
+++ b/src/app/qgsmaptoolshowhidelabels.h
@@ -66,7 +66,7 @@ class APP_EXPORT QgsMapToolShowHideLabels : public QgsMapToolLabel
 
     //! Show or hide chosen label by setting data defined Show Label to 0
     bool showHideLabel( QgsVectorLayer* vlayer,
-                        const QgsFeatureId &fid,
+                        QgsFeatureId fid,
                         bool hide );
 };
 
diff --git a/src/core/pal/pointset.cpp b/src/core/pal/pointset.cpp
index 93150586af1..0f224ee3f8f 100644
--- a/src/core/pal/pointset.cpp
+++ b/src/core/pal/pointset.cpp
@@ -359,7 +359,7 @@ namespace pal
 
   void PointSet::splitPolygons( QLinkedList<PointSet*> &shapes_toProcess,
                                 QLinkedList<PointSet*> &shapes_final,
-                                double xrm, double yrm, const QgsFeatureId& uid )
+                                double xrm, double yrm, QgsFeatureId uid )
   {
 #ifdef _DEBUG_
     std::cout << "splitPolygons: " << uid << std::endl;
diff --git a/src/core/pal/pointset.h b/src/core/pal/pointset.h
index d5fea21036e..6172010c2d0 100644
--- a/src/core/pal/pointset.h
+++ b/src/core/pal/pointset.h
@@ -98,7 +98,7 @@ namespace pal
        */
       static void splitPolygons( QLinkedList<PointSet *> &shapes_toProcess,
                                  QLinkedList<PointSet *> &shapes_final,
-                                 double xrm, double yrm, const QgsFeatureId &uid );
+                                 double xrm, double yrm, QgsFeatureId uid );
 
       /** Returns the squared minimum distance between the point set geometry and the point (px,py)
        * Optionally, the nearest point is stored in (rx,ry).
diff --git a/src/core/qgsfeaturerequest.h b/src/core/qgsfeaturerequest.h
index 3ede2fbdb6c..0fc468a9237 100644
--- a/src/core/qgsfeaturerequest.h
+++ b/src/core/qgsfeaturerequest.h
@@ -258,7 +258,7 @@ class CORE_EXPORT QgsFeatureRequest
     //! Set feature ID that should be fetched.
     QgsFeatureRequest& setFilterFid( QgsFeatureId fid );
     //! Get the feature ID that should be fetched.
-    const QgsFeatureId& filterFid() const { return mFilterFid; }
+    QgsFeatureId filterFid() const { return mFilterFid; }
 
     //! Set feature IDs that should be fetched.
     QgsFeatureRequest& setFilterFids( const QgsFeatureIds& fids );
diff --git a/src/core/qgsvectorlayer.cpp b/src/core/qgsvectorlayer.cpp
index 8c8fec9ae68..cdfe3161453 100644
--- a/src/core/qgsvectorlayer.cpp
+++ b/src/core/qgsvectorlayer.cpp
@@ -409,7 +409,7 @@ void QgsVectorLayer::drawVertexMarker( double x, double y, QPainter& p, QgsVecto
   }
 }
 
-void QgsVectorLayer::select( const QgsFeatureId& fid )
+void QgsVectorLayer::select( QgsFeatureId fid )
 {
   mSelectedFeatureIds.insert( fid );
 
@@ -3684,7 +3684,7 @@ void QgsVectorLayer::onJoinedFieldsChanged()
   updateFields();
 }
 
-void QgsVectorLayer::onFeatureDeleted( const QgsFeatureId& fid )
+void QgsVectorLayer::onFeatureDeleted( QgsFeatureId fid )
 {
   if ( mEditCommandActive )
     mDeletedFids << fid;
diff --git a/src/core/qgsvectorlayer.h b/src/core/qgsvectorlayer.h
index 1b185ba77c9..2c966eb7911 100644
--- a/src/core/qgsvectorlayer.h
+++ b/src/core/qgsvectorlayer.h
@@ -1621,7 +1621,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
      *
      * @see select(QgsFeatureIds)
      */
-    void select( const QgsFeatureId &featureId );
+    void select( QgsFeatureId featureId );
 
     /**
      * Select features by their ID
@@ -1838,7 +1838,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
 
   private slots:
     void onJoinedFieldsChanged();
-    void onFeatureDeleted( const QgsFeatureId& fid );
+    void onFeatureDeleted( QgsFeatureId fid );
 
   protected:
     /** Set the extent */
diff --git a/src/core/qgsvectorlayercache.h b/src/core/qgsvectorlayercache.h
index e5d1dbd2747..cf38b22bccb 100644
--- a/src/core/qgsvectorlayercache.h
+++ b/src/core/qgsvectorlayercache.h
@@ -245,7 +245,7 @@ class CORE_EXPORT QgsVectorLayerCache : public QObject
      * @brief Is emitted when an attribute is changed. Is re-emitted after the layer itself emits this signal.
      *        You should connect to this signal, to be sure, to not get a cached value if querying the cache.
      */
-    void attributeValueChanged( const QgsFeatureId& fid, const int& field, const QVariant &value );
+    void attributeValueChanged( QgsFeatureId fid, const int& field, const QVariant &value );
 
     /**
      * Is emitted, when a new feature has been added to the layer and this cache.
diff --git a/src/plugins/geometry_checker/checks/qgsgeometryanglecheck.cpp b/src/plugins/geometry_checker/checks/qgsgeometryanglecheck.cpp
index efe0f5b5124..eb878dc9c45 100644
--- a/src/plugins/geometry_checker/checks/qgsgeometryanglecheck.cpp
+++ b/src/plugins/geometry_checker/checks/qgsgeometryanglecheck.cpp
@@ -11,7 +11,7 @@
 void QgsGeometryAngleCheck::collectErrors( QList<QgsGeometryCheckError*>& errors, QStringList &/*messages*/, QAtomicInt* progressCounter , const QgsFeatureIds &ids ) const
 {
   const QgsFeatureIds& featureIds = ids.isEmpty() ? mFeaturePool->getFeatureIds() : ids;
-  Q_FOREACH ( const QgsFeatureId& featureid, featureIds )
+  Q_FOREACH ( QgsFeatureId featureid, featureIds )
   {
     if ( progressCounter ) progressCounter->fetchAndAddRelaxed( 1 );
     QgsFeature feature;
diff --git a/src/plugins/geometry_checker/checks/qgsgeometryareacheck.cpp b/src/plugins/geometry_checker/checks/qgsgeometryareacheck.cpp
index 730469b4e71..141410a6561 100644
--- a/src/plugins/geometry_checker/checks/qgsgeometryareacheck.cpp
+++ b/src/plugins/geometry_checker/checks/qgsgeometryareacheck.cpp
@@ -13,7 +13,7 @@
 void QgsGeometryAreaCheck::collectErrors( QList<QgsGeometryCheckError*>& errors, QStringList &/*messages*/, QAtomicInt* progressCounter , const QgsFeatureIds &ids ) const
 {
   const QgsFeatureIds& featureIds = ids.isEmpty() ? mFeaturePool->getFeatureIds() : ids;
-  Q_FOREACH ( const QgsFeatureId& featureid, featureIds )
+  Q_FOREACH ( QgsFeatureId featureid, featureIds )
   {
     if ( progressCounter ) progressCounter->fetchAndAddRelaxed( 1 );
     QgsFeature feature;
@@ -121,7 +121,7 @@ bool QgsGeometryAreaCheck::mergeWithNeighbor( QgsFeature& feature, int partIdx,
   QgsAbstractGeometryV2* geom = feature.geometry()->geometry();
 
   // Search for touching neighboring geometries
-  Q_FOREACH ( const QgsFeatureId& testId, mFeaturePool->getIntersects( feature.geometry()->boundingBox() ) )
+  Q_FOREACH ( QgsFeatureId testId, mFeaturePool->getIntersects( feature.geometry()->boundingBox() ) )
   {
     QgsFeature testFeature;
     if ( !mFeaturePool->get( testId, testFeature ) )
diff --git a/src/plugins/geometry_checker/checks/qgsgeometrycheck.cpp b/src/plugins/geometry_checker/checks/qgsgeometrycheck.cpp
index 9dca7bae6c7..5b1ca173305 100644
--- a/src/plugins/geometry_checker/checks/qgsgeometrycheck.cpp
+++ b/src/plugins/geometry_checker/checks/qgsgeometrycheck.cpp
@@ -49,7 +49,7 @@ double QgsGeometryCheckPrecision::reducedTolerance()
 }
 
 QgsGeometryCheckError::QgsGeometryCheckError( const QgsGeometryCheck* check,
-    const QgsFeatureId& featureId,
+    QgsFeatureId featureId,
     const QgsPointV2& errorLocation,
     const QgsVertexId& vidx,
     const QVariant& value , ValueType valueType )
diff --git a/src/plugins/geometry_checker/checks/qgsgeometrycheck.h b/src/plugins/geometry_checker/checks/qgsgeometrycheck.h
index 51c32ffe37b..d345c1f8f4a 100644
--- a/src/plugins/geometry_checker/checks/qgsgeometrycheck.h
+++ b/src/plugins/geometry_checker/checks/qgsgeometrycheck.h
@@ -87,14 +87,14 @@ class QgsGeometryCheckError
     enum ValueType { ValueLength, ValueArea, ValueOther };
 
     QgsGeometryCheckError( const QgsGeometryCheck* check,
-                           const QgsFeatureId& featureId,
+                           QgsFeatureId featureId,
                            const QgsPointV2& errorLocation,
                            const QgsVertexId& vidx = QgsVertexId(),
                            const QVariant& value = QVariant(),
                            ValueType valueType = ValueOther );
     virtual ~QgsGeometryCheckError();
     const QgsGeometryCheck* check() const { return mCheck; }
-    const QgsFeatureId& featureId() const { return mFeatureId; }
+    QgsFeatureId featureId() const { return mFeatureId; }
     virtual QgsAbstractGeometryV2* geometry();
     virtual QgsRectangle affectedAreaBBox() { return geometry() ? geometry()->boundingBox() : QgsRectangle(); }
     virtual QString description() const { return mCheck->errorDescription(); }
diff --git a/src/plugins/geometry_checker/checks/qgsgeometrycontainedcheck.cpp b/src/plugins/geometry_checker/checks/qgsgeometrycontainedcheck.cpp
index 3061d5a84f0..2ba823a3225 100644
--- a/src/plugins/geometry_checker/checks/qgsgeometrycontainedcheck.cpp
+++ b/src/plugins/geometry_checker/checks/qgsgeometrycontainedcheck.cpp
@@ -12,7 +12,7 @@
 void QgsGeometryContainedCheck::collectErrors( QList<QgsGeometryCheckError*>& errors, QStringList &messages, QAtomicInt* progressCounter , const QgsFeatureIds &ids ) const
 {
   const QgsFeatureIds& featureIds = ids.isEmpty() ? mFeaturePool->getFeatureIds() : ids;
-  Q_FOREACH ( const QgsFeatureId& featureid, featureIds )
+  Q_FOREACH ( QgsFeatureId featureid, featureIds )
   {
     if ( progressCounter ) progressCounter->fetchAndAddRelaxed( 1 );
     QgsFeature feature;
@@ -24,7 +24,7 @@ void QgsGeometryContainedCheck::collectErrors( QList<QgsGeometryCheckError*>& er
     QgsGeometryEngine* geomEngine = QgsGeomUtils::createGeomEngine( feature.geometry()->geometry(), QgsGeometryCheckPrecision::tolerance() );
 
     QgsFeatureIds ids = mFeaturePool->getIntersects( feature.geometry()->geometry()->boundingBox() );
-    Q_FOREACH ( const QgsFeatureId& otherid, ids )
+    Q_FOREACH ( QgsFeatureId otherid, ids )
     {
       if ( otherid == featureid )
       {
diff --git a/src/plugins/geometry_checker/checks/qgsgeometrycontainedcheck.h b/src/plugins/geometry_checker/checks/qgsgeometrycontainedcheck.h
index 25614a6251a..36879030579 100644
--- a/src/plugins/geometry_checker/checks/qgsgeometrycontainedcheck.h
+++ b/src/plugins/geometry_checker/checks/qgsgeometrycontainedcheck.h
@@ -14,12 +14,12 @@ class QgsGeometryContainedCheckError : public QgsGeometryCheckError
 {
   public:
     QgsGeometryContainedCheckError( const QgsGeometryCheck* check,
-                                    const QgsFeatureId& featureId,
+                                    QgsFeatureId featureId,
                                     const QgsPointV2& errorLocation,
-                                    const QgsFeatureId& otherId
+                                    QgsFeatureId otherId
                                   )
         : QgsGeometryCheckError( check, featureId, errorLocation, QgsVertexId(), otherId, ValueOther ), mOtherId( otherId ) { }
-    const QgsFeatureId& otherId() const { return mOtherId; }
+    QgsFeatureId otherId() const { return mOtherId; }
 
     bool isEqual( QgsGeometryCheckError* other ) const override
     {
diff --git a/src/plugins/geometry_checker/checks/qgsgeometrydegeneratepolygoncheck.cpp b/src/plugins/geometry_checker/checks/qgsgeometrydegeneratepolygoncheck.cpp
index 50f3a122888..5045275c2da 100644
--- a/src/plugins/geometry_checker/checks/qgsgeometrydegeneratepolygoncheck.cpp
+++ b/src/plugins/geometry_checker/checks/qgsgeometrydegeneratepolygoncheck.cpp
@@ -11,7 +11,7 @@
 void QgsGeometryDegeneratePolygonCheck::collectErrors( QList<QgsGeometryCheckError*>& errors, QStringList &/*messages*/, QAtomicInt* progressCounter , const QgsFeatureIds &ids ) const
 {
   const QgsFeatureIds& featureIds = ids.isEmpty() ? mFeaturePool->getFeatureIds() : ids;
-  Q_FOREACH ( const QgsFeatureId& featureid, featureIds )
+  Q_FOREACH ( QgsFeatureId featureid, featureIds )
   {
     if ( progressCounter ) progressCounter->fetchAndAddRelaxed( 1 );
     QgsFeature feature;
diff --git a/src/plugins/geometry_checker/checks/qgsgeometryduplicatecheck.cpp b/src/plugins/geometry_checker/checks/qgsgeometryduplicatecheck.cpp
index 32e3e124b95..e917bee1bec 100644
--- a/src/plugins/geometry_checker/checks/qgsgeometryduplicatecheck.cpp
+++ b/src/plugins/geometry_checker/checks/qgsgeometryduplicatecheck.cpp
@@ -14,7 +14,7 @@
 void QgsGeometryDuplicateCheck::collectErrors( QList<QgsGeometryCheckError*>& errors, QStringList &messages, QAtomicInt* progressCounter , const QgsFeatureIds &ids ) const
 {
   const QgsFeatureIds& featureIds = ids.isEmpty() ? mFeaturePool->getFeatureIds() : ids;
-  Q_FOREACH ( const QgsFeatureId& featureid, featureIds )
+  Q_FOREACH ( QgsFeatureId featureid, featureIds )
   {
     if ( progressCounter ) progressCounter->fetchAndAddRelaxed( 1 );
     QgsFeature feature;
@@ -26,7 +26,7 @@ void QgsGeometryDuplicateCheck::collectErrors( QList<QgsGeometryCheckError*>& er
 
     QList<QgsFeatureId> duplicates;
     QgsFeatureIds ids = mFeaturePool->getIntersects( feature.geometry()->geometry()->boundingBox() );
-    Q_FOREACH ( const QgsFeatureId& id, ids )
+    Q_FOREACH ( QgsFeatureId id, ids )
     {
       // > : only report overlaps once
       if ( id >= featureid )
@@ -77,7 +77,7 @@ void QgsGeometryDuplicateCheck::fixError( QgsGeometryCheckError* error, int meth
     QgsGeometryEngine* geomEngine = QgsGeomUtils::createGeomEngine( feature.geometry()->geometry(), QgsGeometryCheckPrecision::tolerance() );
 
     QgsGeometryDuplicateCheckError* duplicateError = static_cast<QgsGeometryDuplicateCheckError*>( error );
-    Q_FOREACH ( const QgsFeatureId& id, duplicateError->duplicates() )
+    Q_FOREACH ( QgsFeatureId id, duplicateError->duplicates() )
     {
       QgsFeature testFeature;
       if ( !mFeaturePool->get( id, testFeature ) )
diff --git a/src/plugins/geometry_checker/checks/qgsgeometryduplicatecheck.h b/src/plugins/geometry_checker/checks/qgsgeometryduplicatecheck.h
index 407a59b0fe9..2301045c120 100644
--- a/src/plugins/geometry_checker/checks/qgsgeometryduplicatecheck.h
+++ b/src/plugins/geometry_checker/checks/qgsgeometryduplicatecheck.h
@@ -14,7 +14,7 @@ class QgsGeometryDuplicateCheckError : public QgsGeometryCheckError
 {
   public:
     QgsGeometryDuplicateCheckError( const QgsGeometryCheck* check,
-                                    const QgsFeatureId& featureId,
+                                    QgsFeatureId featureId,
                                     const QgsPointV2& errorLocation,
                                     const QList<QgsFeatureId>& duplicates )
         : QgsGeometryCheckError( check, featureId, errorLocation, QgsVertexId(), duplicatesString( duplicates ) ), mDuplicates( duplicates ) { }
diff --git a/src/plugins/geometry_checker/checks/qgsgeometryduplicatenodescheck.cpp b/src/plugins/geometry_checker/checks/qgsgeometryduplicatenodescheck.cpp
index 1b79f081e72..58a693a0c12 100644
--- a/src/plugins/geometry_checker/checks/qgsgeometryduplicatenodescheck.cpp
+++ b/src/plugins/geometry_checker/checks/qgsgeometryduplicatenodescheck.cpp
@@ -12,7 +12,7 @@
 void QgsGeometryDuplicateNodesCheck::collectErrors( QList<QgsGeometryCheckError*>& errors, QStringList &/*messages*/, QAtomicInt* progressCounter , const QgsFeatureIds &ids ) const
 {
   const QgsFeatureIds& featureIds = ids.isEmpty() ? mFeaturePool->getFeatureIds() : ids;
-  Q_FOREACH ( const QgsFeatureId& featureid, featureIds )
+  Q_FOREACH ( QgsFeatureId featureid, featureIds )
   {
     if ( progressCounter ) progressCounter->fetchAndAddRelaxed( 1 );
     QgsFeature feature;
diff --git a/src/plugins/geometry_checker/checks/qgsgeometrygapcheck.cpp b/src/plugins/geometry_checker/checks/qgsgeometrygapcheck.cpp
index 4093cc39021..85cba5c859a 100644
--- a/src/plugins/geometry_checker/checks/qgsgeometrygapcheck.cpp
+++ b/src/plugins/geometry_checker/checks/qgsgeometrygapcheck.cpp
@@ -19,7 +19,7 @@ void QgsGeometryGapCheck::collectErrors( QList<QgsGeometryCheckError*>& errors,
   // Collect geometries, build spatial index
   QList<const QgsAbstractGeometryV2*> geomList;
   const QgsFeatureIds& featureIds = ids.isEmpty() ? mFeaturePool->getFeatureIds() : ids;
-  Q_FOREACH ( const QgsFeatureId& id, featureIds )
+  Q_FOREACH ( QgsFeatureId id, featureIds )
   {
     QgsFeature feature;
     if ( mFeaturePool->get( id, feature ) )
@@ -159,7 +159,7 @@ bool QgsGeometryGapCheck::mergeWithNeighbor( QgsGeometryGapCheckError* err, Chan
   QgsAbstractGeometryV2* errGeometry = QgsGeomUtils::getGeomPart( err->geometry(), 0 );
 
   // Search for touching neighboring geometries
-  Q_FOREACH ( const QgsFeatureId& testId, err->neighbors() )
+  Q_FOREACH ( QgsFeatureId testId, err->neighbors() )
   {
     QgsFeature testFeature;
     if ( !mFeaturePool->get( testId, testFeature ) )
diff --git a/src/plugins/geometry_checker/checks/qgsgeometryholecheck.cpp b/src/plugins/geometry_checker/checks/qgsgeometryholecheck.cpp
index 939151133e5..3a323c104e0 100644
--- a/src/plugins/geometry_checker/checks/qgsgeometryholecheck.cpp
+++ b/src/plugins/geometry_checker/checks/qgsgeometryholecheck.cpp
@@ -11,7 +11,7 @@
 void QgsGeometryHoleCheck::collectErrors( QList<QgsGeometryCheckError*>& errors, QStringList &/*messages*/, QAtomicInt* progressCounter , const QgsFeatureIds &ids ) const
 {
   const QgsFeatureIds& featureIds = ids.isEmpty() ? mFeaturePool->getFeatureIds() : ids;
-  Q_FOREACH ( const QgsFeatureId& featureid, featureIds )
+  Q_FOREACH ( QgsFeatureId featureid, featureIds )
   {
     if ( progressCounter ) progressCounter->fetchAndAddRelaxed( 1 );
     QgsFeature feature;
diff --git a/src/plugins/geometry_checker/checks/qgsgeometrymultipartcheck.cpp b/src/plugins/geometry_checker/checks/qgsgeometrymultipartcheck.cpp
index d1c2caeb8da..ea16252da81 100644
--- a/src/plugins/geometry_checker/checks/qgsgeometrymultipartcheck.cpp
+++ b/src/plugins/geometry_checker/checks/qgsgeometrymultipartcheck.cpp
@@ -11,7 +11,7 @@
 void QgsGeometryMultipartCheck::collectErrors( QList<QgsGeometryCheckError*>& errors, QStringList &/*messages*/, QAtomicInt* progressCounter , const QgsFeatureIds &ids ) const
 {
   const QgsFeatureIds& featureIds = ids.isEmpty() ? mFeaturePool->getFeatureIds() : ids;
-  Q_FOREACH ( const QgsFeatureId& featureid, featureIds )
+  Q_FOREACH ( QgsFeatureId featureid, featureIds )
   {
     if ( progressCounter ) progressCounter->fetchAndAddRelaxed( 1 );
     QgsFeature feature;
diff --git a/src/plugins/geometry_checker/checks/qgsgeometryoverlapcheck.cpp b/src/plugins/geometry_checker/checks/qgsgeometryoverlapcheck.cpp
index 7b5ae7ebd9f..1b4640f1471 100644
--- a/src/plugins/geometry_checker/checks/qgsgeometryoverlapcheck.cpp
+++ b/src/plugins/geometry_checker/checks/qgsgeometryoverlapcheck.cpp
@@ -12,7 +12,7 @@
 void QgsGeometryOverlapCheck::collectErrors( QList<QgsGeometryCheckError*>& errors, QStringList &messages, QAtomicInt* progressCounter , const QgsFeatureIds &ids ) const
 {
   const QgsFeatureIds& featureIds = ids.isEmpty() ? mFeaturePool->getFeatureIds() : ids;
-  Q_FOREACH ( const QgsFeatureId& featureid, featureIds )
+  Q_FOREACH ( QgsFeatureId featureid, featureIds )
   {
     if ( progressCounter ) progressCounter->fetchAndAddRelaxed( 1 );
     QgsFeature feature;
@@ -24,7 +24,7 @@ void QgsGeometryOverlapCheck::collectErrors( QList<QgsGeometryCheckError*>& erro
     QgsGeometryEngine* geomEngine = QgsGeomUtils::createGeomEngine( geom, QgsGeometryCheckPrecision::tolerance() );
 
     QgsFeatureIds ids = mFeaturePool->getIntersects( feature.geometry()->boundingBox() );
-    Q_FOREACH ( const QgsFeatureId& otherid, ids )
+    Q_FOREACH ( QgsFeatureId otherid, ids )
     {
       // >= : only report overlaps once
       if ( otherid >= featureid )
diff --git a/src/plugins/geometry_checker/checks/qgsgeometryoverlapcheck.h b/src/plugins/geometry_checker/checks/qgsgeometryoverlapcheck.h
index 44f53c7b48e..6555104ed87 100644
--- a/src/plugins/geometry_checker/checks/qgsgeometryoverlapcheck.h
+++ b/src/plugins/geometry_checker/checks/qgsgeometryoverlapcheck.h
@@ -14,12 +14,12 @@ class QgsGeometryOverlapCheckError : public QgsGeometryCheckError
 {
   public:
     QgsGeometryOverlapCheckError( const QgsGeometryCheck* check,
-                                  const QgsFeatureId& featureId,
+                                  QgsFeatureId featureId,
                                   const QgsPointV2& errorLocation,
                                   const QVariant& value,
-                                  const QgsFeatureId& otherId )
+                                  QgsFeatureId otherId )
         : QgsGeometryCheckError( check, featureId, errorLocation, QgsVertexId(), value, ValueArea ), mOtherId( otherId ) { }
-    const QgsFeatureId& otherId() const { return mOtherId; }
+    QgsFeatureId otherId() const { return mOtherId; }
 
     bool isEqual( QgsGeometryCheckError* other ) const override
     {
diff --git a/src/plugins/geometry_checker/checks/qgsgeometrysegmentlengthcheck.cpp b/src/plugins/geometry_checker/checks/qgsgeometrysegmentlengthcheck.cpp
index 11769f78950..34162ef229f 100644
--- a/src/plugins/geometry_checker/checks/qgsgeometrysegmentlengthcheck.cpp
+++ b/src/plugins/geometry_checker/checks/qgsgeometrysegmentlengthcheck.cpp
@@ -14,7 +14,7 @@
 void QgsGeometrySegmentLengthCheck::collectErrors( QList<QgsGeometryCheckError*>& errors, QStringList &/*messages*/, QAtomicInt* progressCounter , const QgsFeatureIds &ids ) const
 {
   const QgsFeatureIds& featureIds = ids.isEmpty() ? mFeaturePool->getFeatureIds() : ids;
-  Q_FOREACH ( const QgsFeatureId& featureid, featureIds )
+  Q_FOREACH ( QgsFeatureId featureid, featureIds )
   {
     if ( progressCounter ) progressCounter->fetchAndAddRelaxed( 1 );
     QgsFeature feature;
diff --git a/src/plugins/geometry_checker/checks/qgsgeometryselfintersectioncheck.cpp b/src/plugins/geometry_checker/checks/qgsgeometryselfintersectioncheck.cpp
index f66745d80b0..d881959652c 100644
--- a/src/plugins/geometry_checker/checks/qgsgeometryselfintersectioncheck.cpp
+++ b/src/plugins/geometry_checker/checks/qgsgeometryselfintersectioncheck.cpp
@@ -57,7 +57,7 @@ bool QgsGeometrySelfIntersectionCheckError::handleChanges( const QgsGeometryChec
 void QgsGeometrySelfIntersectionCheck::collectErrors( QList<QgsGeometryCheckError*>& errors, QStringList &/*messages*/, QAtomicInt* progressCounter , const QgsFeatureIds &ids ) const
 {
   const QgsFeatureIds& featureIds = ids.isEmpty() ? mFeaturePool->getFeatureIds() : ids;
-  Q_FOREACH ( const QgsFeatureId& featureid, featureIds )
+  Q_FOREACH ( QgsFeatureId featureid, featureIds )
   {
     if ( progressCounter ) progressCounter->fetchAndAddRelaxed( 1 );
     QgsFeature feature;
diff --git a/src/plugins/geometry_checker/checks/qgsgeometryselfintersectioncheck.h b/src/plugins/geometry_checker/checks/qgsgeometryselfintersectioncheck.h
index 84f9debcdbb..7c0cb75493c 100644
--- a/src/plugins/geometry_checker/checks/qgsgeometryselfintersectioncheck.h
+++ b/src/plugins/geometry_checker/checks/qgsgeometryselfintersectioncheck.h
@@ -15,7 +15,7 @@ class QgsGeometrySelfIntersectionCheckError : public QgsGeometryCheckError
 {
   public:
     QgsGeometrySelfIntersectionCheckError( const QgsGeometryCheck* check,
-                                           const QgsFeatureId& featureId,
+                                           QgsFeatureId featureId,
                                            const QgsPointV2& errorLocation,
                                            const QgsVertexId& vidx,
                                            const QgsGeometryUtils::SelfIntersection& inter )
diff --git a/src/plugins/geometry_checker/checks/qgsgeometrytypecheck.cpp b/src/plugins/geometry_checker/checks/qgsgeometrytypecheck.cpp
index 4b09169af6a..6e738d525f2 100644
--- a/src/plugins/geometry_checker/checks/qgsgeometrytypecheck.cpp
+++ b/src/plugins/geometry_checker/checks/qgsgeometrytypecheck.cpp
@@ -18,7 +18,7 @@
 void QgsGeometryTypeCheck::collectErrors( QList<QgsGeometryCheckError*>& errors, QStringList &/*messages*/, QAtomicInt* progressCounter , const QgsFeatureIds &ids ) const
 {
   const QgsFeatureIds& featureIds = ids.isEmpty() ? mFeaturePool->getFeatureIds() : ids;
-  Q_FOREACH ( const QgsFeatureId& featureid, featureIds )
+  Q_FOREACH ( QgsFeatureId featureid, featureIds )
   {
     if ( progressCounter ) progressCounter->fetchAndAddRelaxed( 1 );
     QgsFeature feature;
diff --git a/src/plugins/geometry_checker/checks/qgsgeometrytypecheck.h b/src/plugins/geometry_checker/checks/qgsgeometrytypecheck.h
index 0e0d960fee7..48479fe2e6d 100644
--- a/src/plugins/geometry_checker/checks/qgsgeometrytypecheck.h
+++ b/src/plugins/geometry_checker/checks/qgsgeometrytypecheck.h
@@ -14,7 +14,7 @@ class QgsGeometryTypeCheckError : public QgsGeometryCheckError
 {
   public:
     QgsGeometryTypeCheckError( const QgsGeometryCheck* check,
-                               const QgsFeatureId& featureId,
+                               QgsFeatureId featureId,
                                const QgsPointV2& errorLocation,
                                QgsWKBTypes::Type flatType )
         : QgsGeometryCheckError( check, featureId, errorLocation )
diff --git a/src/plugins/geometry_checker/qgsgeometrychecker.cpp b/src/plugins/geometry_checker/qgsgeometrychecker.cpp
index 1bd957fc4ca..56e8fa77646 100644
--- a/src/plugins/geometry_checker/qgsgeometrychecker.cpp
+++ b/src/plugins/geometry_checker/qgsgeometrychecker.cpp
@@ -98,7 +98,7 @@ bool QgsGeometryChecker::fixError( QgsGeometryCheckError* error, int method )
   // Determine what to recheck
   // - Collect all features which were changed, get affected area
   QgsFeatureIds recheckFeatures;
-  Q_FOREACH ( const QgsFeatureId& id, changes.keys() )
+  Q_FOREACH ( QgsFeatureId id, changes.keys() )
   {
     bool removed = false;
     Q_FOREACH ( const QgsGeometryCheck::Change& change, changes.value( id ) )
diff --git a/src/plugins/geometry_checker/utils/qgsfeaturepool.cpp b/src/plugins/geometry_checker/utils/qgsfeaturepool.cpp
index 59234e56eaa..d366d2cc1cf 100644
--- a/src/plugins/geometry_checker/utils/qgsfeaturepool.cpp
+++ b/src/plugins/geometry_checker/utils/qgsfeaturepool.cpp
@@ -48,7 +48,7 @@ QgsFeaturePool::QgsFeaturePool( QgsVectorLayer *layer, bool selectedOnly )
   }
 }
 
-bool QgsFeaturePool::get( const QgsFeatureId& id , QgsFeature& feature )
+bool QgsFeaturePool::get( QgsFeatureId id , QgsFeature& feature )
 {
   QMutexLocker lock( &mLayerMutex );
   QgsFeature* pfeature = mFeatureCache.object( id );
diff --git a/src/plugins/geometry_checker/utils/qgsfeaturepool.h b/src/plugins/geometry_checker/utils/qgsfeaturepool.h
index 3afb5302661..829595f8e8d 100644
--- a/src/plugins/geometry_checker/utils/qgsfeaturepool.h
+++ b/src/plugins/geometry_checker/utils/qgsfeaturepool.h
@@ -31,7 +31,7 @@ class QgsFeaturePool
 {
   public:
     QgsFeaturePool( QgsVectorLayer* layer, bool selectedOnly = false );
-    bool get( const QgsFeatureId& id, QgsFeature& feature );
+    bool get( QgsFeatureId id, QgsFeature& feature );
     void addFeature( QgsFeature &feature );
     void updateFeature( QgsFeature &feature );
     void deleteFeature( QgsFeature &feature );
diff --git a/src/plugins/geometry_snapper/qgsgeometrysnapper.cpp b/src/plugins/geometry_snapper/qgsgeometrysnapper.cpp
index f998915f6fb..7e142197ad7 100644
--- a/src/plugins/geometry_snapper/qgsgeometrysnapper.cpp
+++ b/src/plugins/geometry_snapper/qgsgeometrysnapper.cpp
@@ -52,7 +52,7 @@ QFuture<void> QgsGeometrySnapper::processFeatures()
   return QtConcurrent::map( mFeatures, ProcessFeatureWrapper( this ) );
 }
 
-void QgsGeometrySnapper::processFeature( const QgsFeatureId &id )
+void QgsGeometrySnapper::processFeature( QgsFeatureId id )
 {
   // Get current feature
   QgsFeature feature;
@@ -75,7 +75,7 @@ void QgsGeometrySnapper::processFeature( const QgsFeatureId &id )
   mIndexMutex.lock();
   QList<QgsFeatureId> refFeatureIds = mIndex.intersects( feature.geometry()->boundingBox() );
   mIndexMutex.unlock();
-  Q_FOREACH ( const QgsFeatureId& refId, refFeatureIds )
+  Q_FOREACH ( QgsFeatureId refId, refFeatureIds )
   {
     QgsFeature refFeature;
     if ( getFeature( mReferenceLayer, mReferenceLayerMutex, refId, refFeature ) )
@@ -232,7 +232,7 @@ void QgsGeometrySnapper::processFeature( const QgsFeatureId &id )
   mAdjustLayerMutex.unlock();
 }
 
-bool QgsGeometrySnapper::getFeature( QgsVectorLayer *layer, QMutex &mutex, const QgsFeatureId &id, QgsFeature &feature )
+bool QgsGeometrySnapper::getFeature( QgsVectorLayer *layer, QMutex &mutex, QgsFeatureId id, QgsFeature &feature )
 {
   QMutexLocker locker( &mutex );
   QgsFeatureRequest req( id );
diff --git a/src/plugins/geometry_snapper/qgsgeometrysnapper.h b/src/plugins/geometry_snapper/qgsgeometrysnapper.h
index 021e80a9c70..45dc05a9fe3 100644
--- a/src/plugins/geometry_snapper/qgsgeometrysnapper.h
+++ b/src/plugins/geometry_snapper/qgsgeometrysnapper.h
@@ -40,7 +40,7 @@ class QgsGeometrySnapper : public QObject
     {
       QgsGeometrySnapper* instance;
       explicit ProcessFeatureWrapper( QgsGeometrySnapper* _instance ) : instance( _instance ) {}
-      void operator()( const QgsFeatureId& id ) { instance->processFeature( id ); }
+      void operator()( QgsFeatureId id ) { instance->processFeature( id ); }
     };
 
     enum PointFlag { SnappedToRefNode, SnappedToRefSegment, Unsnapped };
@@ -57,8 +57,8 @@ class QgsGeometrySnapper : public QObject
     QMutex mAdjustLayerMutex;
     QMutex mReferenceLayerMutex;
 
-    void processFeature( const QgsFeatureId& id );
-    bool getFeature( QgsVectorLayer* layer, QMutex& mutex, const QgsFeatureId &id, QgsFeature& feature );
+    void processFeature( QgsFeatureId id );
+    bool getFeature( QgsVectorLayer* layer, QMutex& mutex, QgsFeatureId id, QgsFeature& feature );
     int polyLineSize( const QgsAbstractGeometryV2* geom, int iPart, int iRing ) const;
 };
 
diff --git a/src/providers/virtual/qgsvirtuallayerfeatureiterator.cpp b/src/providers/virtual/qgsvirtuallayerfeatureiterator.cpp
index 01206d50e4e..000d184ad9a 100644
--- a/src/providers/virtual/qgsvirtuallayerfeatureiterator.cpp
+++ b/src/providers/virtual/qgsvirtuallayerfeatureiterator.cpp
@@ -64,7 +64,7 @@ QgsVirtualLayerFeatureIterator::QgsVirtualLayerFeatureIterator( QgsVirtualLayerF
     {
       QString values = quotedColumn( mDefinition.uid() ) + " IN (";
       bool first = true;
-      Q_FOREACH ( const QgsFeatureId &v, request.filterFids() )
+      Q_FOREACH ( QgsFeatureId v, request.filterFids() )
       {
         if ( !first )
         {