mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
Fix default layer sometimes inserted into multi layer parameter values
This commit is contained in:
parent
48eccc379d
commit
e1b0f78619
@ -622,7 +622,7 @@ QList<QgsMapLayer *> QgsProcessingParameters::parameterAsLayerList( const QgsPro
|
||||
else
|
||||
resultStringList << val.toString();
|
||||
|
||||
if ( ( resultStringList.isEmpty() || resultStringList.at( 0 ).isEmpty() ) )
|
||||
if ( layers.isEmpty() && ( resultStringList.isEmpty() || resultStringList.at( 0 ).isEmpty() ) )
|
||||
{
|
||||
resultStringList.clear();
|
||||
// check default
|
||||
|
@ -2310,6 +2310,9 @@ void TestQgsProcessing::parameterLayerList()
|
||||
params.insert( "optional", QVariant() );
|
||||
QCOMPARE( QgsProcessingParameters::parameterAsLayerList( def.get(), params, context ), QList< QgsMapLayer *>() << v1 );
|
||||
|
||||
params.insert( "optional", QVariantList() << QVariant::fromValue( r1 ) );
|
||||
QCOMPARE( QgsProcessingParameters::parameterAsLayerList( def.get(), params, context ), QList< QgsMapLayer *>() << r1 );
|
||||
|
||||
code = def->asScriptCode();
|
||||
QCOMPARE( code, QStringLiteral( "##optional=optional multiple vector " ) + v1->id() );
|
||||
fromCode.reset( dynamic_cast< QgsProcessingParameterMultipleLayers * >( QgsProcessingParameters::parameterFromScriptCode( code ) ) );
|
||||
|
Loading…
x
Reference in New Issue
Block a user