[Qgis-developer] Load an editable layer as a read-only one

Giuseppe Sucameli brush.tyler at gmail.com
Mon Oct 25 10:00:57 EDT 2010


Hi Martin,
sorry for this reply so late.

On Thu, Oct 7, 2010 at 11:04 PM, Martin Dobias <wonder.sk at gmail.com> wrote:

> Hi Giuseppe
>
> On Tue, Oct 5, 2010 at 1:12 AM, Giuseppe Sucameli <brush.tyler at gmail.com>
> wrote:
> > Hi devs,
> >
> > there is a way to load an editable layer without editing capabilities?
> > I searched for a setCapabilities() method, but nothing.
> > Reducing the layer capabilities would be useful, especially for plugins,
> > obviously
> > without adding new capabilities.
> >
> > In a C++ plugin I can extend the concrete DataProvider class.
> > There is a way to do the same thing in a python plugin? Maybe creating a
> > wrapper
> > to the layer dataProvider?
>
> I am not aware of such functionality. But it would be possible to add
> a pair of methods setReadOnly(bool) and isReadOnly() for the layers.
> If set as read only, editing would be disabled.
>
I think this would be a nice feature for pyplugins developers.

In this moment the only workaround to make a layer uneditable is creating a
plugin window containing a new canvas, then adding the layer in this new
canvas,
but you can neither use useful tools (e.g all the newest selection tools) or
qgis
mainwindow capabilities (add layers, move layers, ...).

I'm going to open a ticket on trac.

Cheers.

-- 
Giuseppe Sucameli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20101025/6b3b8d68/attachment.html


More information about the Qgis-developer mailing list