[QGIS-Developer] Remove all rubberbands from the canvas
Tim Sutton
tim at kartoza.com
Tue Sep 22 02:19:58 PDT 2020
Hi Paul
AFAIK you need to keep track of all the rubber bands you add and then reset
them when you want to clean them up. See some example code here:
https://github.com/inasafe/inasafe/blob/develop/safe/gui/tools/rectangle_map_tool.py#L56
Regards
Tim
On Tue, Sep 22, 2020 at 9:02 AM Paul Wittle <
paul.wittle at dorsetcouncil.gov.uk> wrote:
> Hi,
>
>
>
> I’m having an issue with the documentation this morning. I’m writing a
> small python plugin and adding rubberbands to the canvas which is fine but
> for some reason I can’t seem to remove them from the canvas at the end.
>
>
>
> To start with, this is because I’d not put anything in to remove them but
> now I’m using the iface.mapCanvas.scene().removeItem() function and they
> still are present.
>
>
>
> I have two questions really:
>
> 1. I can’t see scene defined in the documentation for QgsMapCanvas; is
> this something that should be there?
> 2. Is there a way to simply remove all scenes from the canvas?
>
>
>
> Any help would be great 😊
>
> Thanks,
>
>
>
> *Paul Wittle *
>
> <https://www.dorsetcouncil.gov.uk/>
>
> *Business Solutions Analyst (GIS)*
>
> *ICT Operations *
>
> *Dorset Council*
>
> 01305 228473
> <01305%20228473%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20>
>
> dorsetcouncil.gov.uk <https://www.dorsetcouncil.gov.uk>
>
>
>
> <https://www.facebook.com/DorsetCouncilUK>
>
> <https://instagram.com/DorsetCouncilUK>
>
> <https://twitter.com/DorsetCouncilUK>
>
>
> This e-mail and any files transmitted with it are intended solely for the
> use of the individual or entity to whom they are addressed. It may contain
> unclassified but sensitive or protectively marked material and should be
> handled accordingly. Unless you are the named addressee (or authorised to
> receive it for the addressee) you may not copy or use it, or disclose it to
> anyone else. If you have received this transmission in error please notify
> the sender immediately. All traffic may be subject to recording and/or
> monitoring in accordance with relevant legislation. Any views expressed in
> this message are those of the individual sender, except where the sender
> specifies and with authority, states them to be the views of Dorset
> Council. Dorset Council does not accept service of documents by fax or
> other electronic means. Virus checking: Whilst all reasonable steps have
> been taken to ensure that this electronic communication and its attachments
> whether encoded, encrypted or otherwise supplied are free from computer
> viruses, Dorset Council accepts no liability in respect of any loss, cost,
> damage or expense suffered as a result of accessing this message or any of
> its attachments. For information on how Dorset Council processes your
> information, please see www.dorsetcouncil.gov.uk/416433
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
--
------------------------------------------------------------------------------------------
Tim Sutton
Visit http://kartoza.com to find out about open source:
* Desktop GIS programming services
* Geospatial web development
* GIS Training
* Consulting Services
Skype: timlinux Irc: timlinux on #qgis at freenode.net
Tim is a member of the QGIS Project Steering Committee
-------------------------------------------------------------------------------------------
Kartoza is a merger between Linfiniti and Afrispatial
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200922/3cdb99b5/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 5772 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200922/3cdb99b5/attachment-0001.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 3147 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200922/3cdb99b5/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 6146 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200922/3cdb99b5/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.png
Type: image/png
Size: 2536 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200922/3cdb99b5/attachment-0005.png>
More information about the QGIS-Developer
mailing list