Ok. That was a bug in the SIP bindings. Fixed in commit:32978fb4. Apparently the names of the signals have to match in python and C++ - so qint64
doesn't work as expected.
In Windows there are still some issues, though. See bug #6573
Just to be more elaborate than the comment.
Basically, the postProcessAlgorithm()
does what it says. It also returns a value map, including the OUTPUT
. However, you need to look up the layer in the algorithm's context with QgsProcessingUtils.mapLayerFromString()
. For that to work, you have to save a reference to the original output layer from processAlgorithm()
:
class ORSisochronesAlgo(QgsProcessingAlgorithm):
dest_id = None # Save a reference to the output layer id
def initAlgorithm(self, configuration, p_str=None, Any=None, *args, **kwargs):
# add all input parameters
self.addParameter(
QgsProcessingParameterFeatureSink(
'OUTPUT',
'Output layer'
)
)
def processAlgorithm(self, parameters, context, feedback):
source = self.parameterAsSource(parameters, self.INPUT, context)
(sink, self.dest_id) = self.parameterAsSink(parameters, self.OUTPUT,
context, source.fields(), source.wkbType(), source.sourceCrs())
features = source.getFeatures()
for feature in features:
new_feature = QgsFeature()
# Some API calls and processing to populate new feature
sink.addFeature(new_feature, QgsFeatureSink.FastInsert)
return {self.OUTPUT: dest_id}
def postProcessAlgorithm(self, context, feedback):
processed_layer = QgsProcessingUtils.mapLayerFromString(self.dest_id, context)
# Do smth with the layer, e.g. style it
return {self.OUT: self.dest_id}
Best Answer
You want the isEditable method: