[Qgis-developer] Filtering a shapefile and editing

Jürgen E. Fischer jef at norbit.de
Thu Sep 11 08:54:31 PDT 2014


Hi Paolo,

On Thu, 11. Sep 2014 at 17:04:46 +0200, Paolo Cavallini wrote:
> If I filter a shapefile after loading it, the layer can no longer be
> edited. Is this a provider limitation, or can we do something about it?

Yes.

> Moreover, if I remove the filter after attempting to edit it, the layer
> remains impossible to edit until I reload it once more (and I believe this is
> a bug).

Right, filter shape file layers are not editable.  But there's currently no way
for a OGR provider to propagate that some changes (eg. setting of a filter)
changes the layer's capabilities (ie.  disables editing capabities).  Because
of that the GUI doesn't reflect it and the "pencil" is not grayed out, although
it should.   So although you shouldn't be able to, you still can try.   But
that fails and QGIS disables the pencil.  So you can't retry again.

But resetting the filter doesn't change that and that could be considered a
bug.  But it's somewhat like makeing the files readonly while QGIS still thinks
they are writable.  That would go unnoticed too.

And there's a simple workaround, you can simply activate a different layer and
go back. QGIS will ask the provider again for the layer's capabilities and
switch the buttons accordingly.   That also goes for the pencil - if the layer
goes readonly by setting a filter, you switch to a different layer and back
it'll turn grey.


Jürgen

-- 
Jürgen E. Fischer           norBIT GmbH             Tel. +49-4931-918175-31
Dipl.-Inf. (FH)             Rheinstraße 13          Fax. +49-4931-918175-50
Software Engineer           D-26506 Norden             http://www.norbit.de
QGIS release manager (PSC)  Germany                    IRC: jef on FreeNode                         
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 827 bytes
Desc: Digital signature
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20140911/25bb3eda/attachment-0001.pgp>


More information about the Qgis-developer mailing list