When I call the following (using QGIS 3.0.2):

self.layerCatalog =  QgsCore.QgsVectorLayer( "MultiPolygon?%s" % s_fields, nameLayer, "memory")

if self.iface.mapCanvas().isCachingEnabled():

I get the error "AttributeError: 'QgsVectorLayer' object has no attribute 'setCacheImage'"

setCacheImage is a function in the parent class QgsMapLayer in QGIS 2. It is not there in QGIS 3. Looking at the Backwards Incompatible Changes site here, I do not see where it was moved or renamed. Anyone know?

1 Answer 1


I think I found the answer. Via the Deprecated List, "since 2.4 - caches listen to repaintRequested() signal to invalidate the cached image". Apparently calling triggerRepaint(True) will emit repaintRequested with defferUpdate set to True. I believe that would do the same thing?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.