mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
Offline editing: preserve join field names (layer prefix)
This commit is contained in:
parent
3dbf70ffe5
commit
772033dac4
@ -95,7 +95,24 @@ bool QgsOfflineEditing::convertToOfflineProject( const QString& offlineDataPath,
|
||||
{
|
||||
QgsMapLayer* layer = QgsMapLayerRegistry::instance()->mapLayer( layerIds.at( i ) );
|
||||
QgsVectorLayer* vl = qobject_cast<QgsVectorLayer*>( layer );
|
||||
const QgsVectorJoinList& joins = vl->vectorJoins();
|
||||
QgsVectorJoinList joins = vl->vectorJoins();
|
||||
|
||||
// Layer names will be appended an _offline suffix
|
||||
// Join fields are prefixed with the layer name and we do not want the
|
||||
// field name to change so we stabilize the field name by defining a
|
||||
// custom prefix with the layername without _offline suffix.
|
||||
QgsVectorJoinList::iterator it = joins.begin();
|
||||
while ( it != joins.end() )
|
||||
{
|
||||
if (( *it ).prefix.isNull() )
|
||||
{
|
||||
QgsVectorLayer* vl = qobject_cast<QgsVectorLayer*>( QgsMapLayerRegistry::instance()->mapLayer(( *it ).joinLayerId ) );
|
||||
|
||||
if ( vl )
|
||||
( *it ).prefix = vl->name() + "_";
|
||||
}
|
||||
++it;
|
||||
}
|
||||
joinInfoBuffer.insert( vl->id(), joins );
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user