0

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():
        self.layerCatalog.setCacheImage(None)

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?

0

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, privacy policy and cookie policy

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