Bug report #4361

Edit button is not updated when provider query makes a layer read-only

Added by Alister Hood about 9 years ago. Updated over 1 year ago.

Status:Closed
Priority:Low
Assignee:-
Category:Vectors
Affected QGIS version:master Regression?:No
Operating System:All Easy fix?:No
Pull Request or Patch supplied:No Resolution:end of life
Crashes QGIS or corrupts data:No Copied to github as #:14294

Description

Quoting from a mention in #3052:
As soon as you place a query on a shapefile, it's capabilities drop from 975 to 704, which raises "Provider cannot be opened for editing".

Creating a query also creates an inconsistency in the UI:

Whilst the editing pen is still blue in the toolbar, it's already greyed out in the attributes table. Clicking the pen in the toolbar raises aforementioned error and stalls it in grey. Removing the query doesn't solve this issue. Opening the attributes table again, the pen is blue there.

So it seems, the toolbar's symbol is not up to date.

975 and 704 equal:

[[PyQt]]4.QtCore.QString(u'Add Features, Delete Features, Change Attribute Values, Add Attributes, Create Spatial Index, Fast Access to Features at ID, Change Geometries')

and  

[[PyQt]]4.QtCore.QString(u'Create Spatial Index, Fast Access to Features at ID')

===================

That description isn't completely accurate - the button isn't "already" greyed out in the attribute table. If you open the attribute table after the query is set, then it will be greyed out. If you open it after the query is removed, it will not be greyed out. The button doesn't update in an attribute table that is already open.

Also note:
- If a provider doesn't support attribute updates (e.g. the attached example vrt using a csv file), then the edit button will always be greyed out in the attribute table. So if you set a query on the layer, then try to enable editing, the button will grey out, and to be able to edit the layer you will need to remove the query and either save and reopen the project, or remove the layer and add it again.
- The error message when you try to enable editing with a query set doesn't actually identify the problem, so most users probably wouldn't know how to deal with it:

Start editing failed
Provider cannot be opened for editing

test.csv Magnifier (141 Bytes) Alister Hood, 2011-10-06 10:10 PM

test.ovf (328 Bytes) Alister Hood, 2011-10-06 10:10 PM

History

#1 Updated by Alister Hood about 9 years ago

example vrt

#2 Updated by Jürgen Fischer about 9 years ago

  • Priority changed from Normal to Low

#3 Updated by Giovanni Manghi almost 9 years ago

  • Target version set to Version 1.7.4

#4 Updated by Paolo Cavallini over 8 years ago

  • Crashes QGIS or corrupts data set to No
  • Affected QGIS version set to master
  • Target version changed from Version 1.7.4 to Version 1.8.0

#5 Updated by Paolo Cavallini about 8 years ago

  • Target version changed from Version 1.8.0 to Version 2.0.0

#6 Updated by Jürgen Fischer over 6 years ago

  • Target version changed from Version 2.0.0 to Future Release - Lower Priority

#7 Updated by Giovanni Manghi over 3 years ago

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

#8 Updated by Giovanni Manghi over 1 year ago

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

Also available in: Atom PDF