I've tested the attributeValueChanged
SIGNAL in a created-from-scratch test plugin using QGIS v.2.6.1
You can connect the SIGNAL to your slot this way (I did it in my run()
method):
def run(self):
self.lyr = self.iface.mapCanvas().layers()[0]
self.lyr.attributeValueChanged.connect(self.mySlot)
And then, you have two options to write your slot (see mySlot
and mySlot2
):
def mySlot(self):
QMessageBox.information( self.iface.mainWindow(), "Test",
"Attributes were changed!!!", QMessageBox.Ok )
def mySlot2(self, fid, idx, v):
QMessageBox.information( self.iface.mainWindow(), "Test",
"Attributes changed for feature " + str(fid), QMessageBox.Ok )
Both slots work, just replace self.mySlot
by self.mySlot2
in the connect method above if you want to switch between them.
If you want to get the test plugin, run it on your QGIS, and have a look at the code, you can access to it here. You find installation and usage instructions in the README file.
Best Answer
It may very well be a bug as I also cannot get the canvas to refresh. You can try the following as a workaround:
To refresh all layers following function can be used: