Skip to content
Permalink
Browse files

Make QgsAlgorithm::setProvider() public

Turns out there's valid use cases for calling this from outside
code.
  • Loading branch information
nyalldawson committed Jun 24, 2017
1 parent b1cadb1 commit 5e7fbf44befcf66879708b0be50375a720261313
@@ -267,6 +267,11 @@ class QgsProcessingAlgorithm
:rtype: str
%End

void setProvider( QgsProcessingProvider *provider );
%Docstring
Associates this algorithm with its provider. No transfer of ownership is involved.
%End

protected:

bool addParameter( QgsProcessingParameterDefinition *parameterDefinition /Transfer/ );
@@ -473,7 +478,6 @@ class QgsProcessingAlgorithm
:rtype: list of str
%End


private:
QgsProcessingAlgorithm( const QgsProcessingAlgorithm &other );
};
@@ -244,6 +244,7 @@ def _mimeDataAlgorithm(items):

else:
self.model = ModelerAlgorithm()
self.model.setProvider(QgsApplication.processingRegistry().providerById('model'))

self.fillInputsTree()
self.fillAlgorithmTree()
@@ -476,6 +477,7 @@ def openModel(self):
alg = ModelerAlgorithm()
if alg.fromFile(filename):
self.model = alg
self.model.setProvider(QgsApplication.processingRegistry().providerById('model'))
self.textGroup.setText(alg.group())
self.textName.setText(alg.name())
self.repaintModel()
@@ -264,6 +264,11 @@ class CORE_EXPORT QgsProcessingAlgorithm
*/
virtual QString asPythonCommand( const QVariantMap &parameters, QgsProcessingContext &context ) const;

/**
* Associates this algorithm with its provider. No transfer of ownership is involved.
*/
void setProvider( QgsProcessingProvider *provider );

protected:

/**
@@ -445,18 +450,12 @@ class CORE_EXPORT QgsProcessingAlgorithm
*/
QStringList parameterAsFields( const QVariantMap &parameters, const QString &name, QgsProcessingContext &context ) const;


private:

QgsProcessingProvider *mProvider = nullptr;
QgsProcessingParameterDefinitions mParameters;
QgsProcessingOutputDefinitions mOutputs;

/**
* Associates this algorithm with its provider. No transfer of ownership is involved.
*/
void setProvider( QgsProcessingProvider *provider );

// friend class to access setProvider() - we do not want this public!
friend class QgsProcessingProvider;
friend class TestQgsProcessing;

0 comments on commit 5e7fbf4

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