[QGIS-Developer] Activate vertex tool with a specific polygon highligted from Python

Jorge Gustavo Rocha jgr at di.uminho.pt
Mon Feb 8 02:26:50 PST 2021


Hi Bo,

I didn't investigate it much. I just tried on the console:
iface.actionVertexToolActiveLayer().trigger()
and it works. It open the vertex editor, but no geometry is "locked".
You have to manually lock your geometry with a right mouse click.

You want to mimic also the right click to selected the geometry to be
used by the vertex editor, right? I think you want to call
'QgsVertexTool::updateVertexEditor( QgsVectorLayer *layer, QgsFeatureId
fid )' but QgsVertexTool does not have bindings for python.

Maybe there is another way to do it. Let's see if someone knows how to
lock the selected geometry in Python.

Good luck!

Jorge

Às 16:35 de 07/02/21, Bo Victor Thomsen escreveu:
> Hi list -
> 
> Is there any way/method - using python - to activate the Vertex Tool
> with a specific object from a specific layer ? The position and
> attribute values for the object is known.
> 
> The situation is as follows:
> 
>  1. The user has pushed a button i a plugin dialog.
>  2. The function to this event automatically generates  a polygon.
>  3. The geometry is calculated from the position and extend of the
>     current mapper window.
>  4. The polygon is inserted in a known layer.
>  5. This layer is made user editable
> 
>  6. The vertex tool is activated with the inserted polygon highlighted
> 
> Point 1-5 is working fine. It's point 6 I'm asking about
> 
> -- 
> Med venlig hilsen / Kind regards
> 
> Bo Victor Thomsen
> 
> 
> _______________________________________________
> 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
> 

J. Gustavo
-- 
Jorge Gustavo Rocha
Departamento de Informática
Universidade do Minho
4710-057 Braga
Gabinete 3.29 (Piso 3)
Tel: +351 253604480
Fax: +351 253604471
Móvel: +351 910333888
skype: nabocudnosor


More information about the QGIS-Developer mailing list