Bug report #14490

QgsMapLayer::dataChanged not emited when QgsVectorLayer data are modified

Added by Vincent Mora over 4 years ago. Updated over 1 year ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Data Provider
Affected QGIS version:2.8.3 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:end of life
Crashes QGIS or corrupts data:No Copied to github as #:22466

Description

To reproduce activate a vector layer, and in the in the python console:

def prt():
print "changed"
iface.activeLayer().dataChanged.connect(prt)

Open the attribute table and change an attribute, save -> nothing

iface.activeLayer().editingStopped.connect(prt)

Works instead, but it's not really the first thing that comes to mind (actually it only came to mine by looking at QgsVectorLayer::commitChanges source code).

History

#1 Updated by Giovanni Manghi over 4 years ago

  • Category set to Python plugins

#2 Updated by Hugo Mercier about 4 years ago

  • Status changed from Open to Feedback
  • Category changed from Python plugins to Data Provider

Indeed. Also observed on 2.15

Actually, this dataChanged signal seems to be used only on setSubsetString() of each provider ...
There is also a layerModified signal which is only emitted when attribute aliases are created or removed ...

A "something has changed" signal (for feature addition/removal/modification) could be helpful.

What about choosing only one signal and emitting it when one of the other modification signals is emitted ? (maybe for qgis 3.0)

#3 Updated by Giovanni Manghi over 3 years ago

  • Status changed from Feedback to Open

#4 Updated by Giovanni Manghi over 3 years ago

  • Regression? set to No
  • Easy fix? set to No

#5 Updated by Giovanni Manghi over 1 year ago

  • Resolution set to end of life
  • Status changed from Open to Closed

Also available in: Atom PDF