Skip to content

Commit

Permalink
Initialise algorithms when they are added to a provider
Browse files Browse the repository at this point in the history
By initializing the prototype of the algorithm stored in the
provider we allow shortcuts like directly querying the parameter
definitions from the provider's prototype (instead of having
to create a new instance and manually initialize it first)
  • Loading branch information
nyalldawson committed Jul 12, 2017
1 parent 0b737ff commit c59aeab
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/processing/qgsprocessingprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ bool QgsProcessingProvider::addAlgorithm( QgsProcessingAlgorithm *algorithm )
if ( mAlgorithms.contains( algorithm->name() ) )
return false;

// init the algorithm - this allows direct querying of the algorithm's parameters
// and outputs from the provider's copy
algorithm->initAlgorithm( QVariantMap() );

algorithm->setProvider( this );
mAlgorithms.insert( algorithm->name(), algorithm );
return true;
Expand Down

0 comments on commit c59aeab

Please sign in to comment.