Skip to content
Permalink
Browse files
[offline editing] fix overwriting of first field on remote layer when…
… it has virtual fields (#45003)
  • Loading branch information
3nids committed Sep 9, 2021
1 parent 0a7bcf3 commit 0a9afa075db50bbd95a8bc7da43a6b5ab1f40690
Showing with 5 additions and 3 deletions.
  1. +5 −3 src/core/qgsofflineediting.cpp
@@ -963,12 +963,15 @@ void QgsOfflineEditing::applyFeaturesAdded( QgsVectorLayer *offlineLayer, QgsVec
{
// NOTE: SpatiaLite provider ignores position of geometry column
// restore gap in QgsAttributeMap if geometry column is not last (WORKAROUND)
QMap<int, int> attrLookup = attributeLookup( offlineLayer, remoteLayer );
const QMap<int, int> attrLookup = attributeLookup( offlineLayer, remoteLayer );
QgsAttributes newAttrs( newAttrsCount );
QgsAttributes attrs = it->attributes();
for ( int it = 0; it < attrs.count(); ++it )
{
int remoteAttributeIndex = attrLookup[ it ];
const int remoteAttributeIndex = attrLookup.value( it, -1 );
// if virtual or non existing field
if ( remoteAttributeIndex == -1 )
continue;
QVariant attr = attrs.at( it );
if ( remoteLayer->fields().at( remoteAttributeIndex ).type() == QVariant::StringList )
{
@@ -1614,4 +1617,3 @@ void QgsOfflineEditing::setupLayer( QgsMapLayer *layer )
}
}
}

0 comments on commit 0a9afa0

Please sign in to comment.