[QGIS-Developer] Accessing existing QgsRubberBand created by actionAddFeature from Python

Denis Rouzaud denis.rouzaud at gmail.com
Sun Nov 17 21:47:33 PST 2019


Hi,

One way is to create your own map tool. The add feature tool
inherits QgsMapToolDigitizeFeature, which will contains already a lot. You
can have a look at the cpp code of QgsMapToolAddFeature and replicate in
Python. But I guess you might find some good examples by searching a bit on
the web.

Otherwise, you can still access the rubber band by accessing the rubberband
(which is a QGraphicsItem) by listing items of the map canvas (which is a
QGraphicsView). Without knowing much more, that wouldn't be my preferred
approach. It sounds a bit clumsy both in terms of code and UX.

Denis

Le lun. 18 nov. 2019 à 06:37, 5Nap <olimpiysky at gmail.com> a écrit :

> Hello!
> I'm trying to find a way to modify rubber band, created by AddFeature
> action.
> The idea is to continue editing by another mapping tool with option to
> switch between built-in tools (add new feature, construct arc from "shape
> digitizing toolbar" and so on) and my own custom tool.
>
> Is there such possibility?
>
> The only way I've found so far creates new rubber band without accesing the
> existing one.
>
> I'm using python,  QGIS3.10
>
>
>
> --
> Sent from:
> http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html
> _______________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20191118/968f4c3f/attachment.html>


More information about the QGIS-Developer mailing list