Skip to content
Permalink
Browse files

On duplicate copy join and virtual fields

Fixes #14191
  • Loading branch information
m-kuhn committed Feb 5, 2016
1 parent 0e3faf7 commit 57b5eb954ef988489456fcd14b236bb784d150a2
Showing with 9 additions and 0 deletions.
  1. +9 −0 src/app/qgisapp.cpp
@@ -7812,6 +7812,15 @@ void QgisApp::duplicateLayers( const QList<QgsMapLayer *>& lyrList )
QgsExpressionContextUtils::setLayerVariable( dupVLayer, variableName, varValue );
}

Q_FOREACH ( const QgsVectorJoinInfo& join, vlayer->vectorJoins() )
dupVLayer->addJoin( join );

for ( int fld = 0; fld < vlayer->fields().count(); fld++ )
{
if ( vlayer->fields().fieldOrigin( fld ) == QgsFields::OriginExpression )
dupVLayer->addExpressionField( vlayer->expressionField( fld ), vlayer->fields().at( fld ) );
}

dupLayer = dupVLayer;
}
}

5 comments on commit 57b5eb9

@nirvn

This comment has been minimized.

Copy link
Contributor

@nirvn nirvn replied Feb 5, 2016

Brilliant, thanks for fixing the joins too.

@3nids

This comment has been minimized.

Copy link
Member

@3nids 3nids replied Feb 5, 2016

How would it work for relations?
Duplicate with new id? Adapt fields accordingly?

@m-kuhn

This comment has been minimized.

Copy link
Member Author

@m-kuhn m-kuhn replied Feb 5, 2016

That's probably the best we can get with relations.

@SebDieBln

This comment has been minimized.

Copy link
Contributor

@SebDieBln SebDieBln replied Feb 19, 2016

thanks for fixing the joins too

The joins were not broken at all, so now duplicated layers get every join twice. See PR #2816.

@m-kuhn

This comment has been minimized.

Copy link
Member Author

@m-kuhn m-kuhn replied Feb 20, 2016

Sorry for that and thanks for the fix

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