0

I want to create a plugin and in a window I need to make the same functionality as the toolbar advance digitize (merge, split features ...).

Is there any possibility of calling the functions already implemented in QGIS (merge, split features ...) without having to create them from scratch?

If so, I seek documentation.

3

You can use virtual QAction from QgsInterface Class. There is for your purpose, actionSplitFeature() that you can trigger when the user click on your button.

for example you can define a function like that (you can add the code you need for your task, like set the layer to work with, selecting features,...):

def mySplitFeature():
    self.iface.actionSplitFeatures().trigger()

and connect your button to this function like that:

self.dockwidget.your_button.clicked.connect(self.mySplitFeature)

so when you click your button, the split features tool will be trigger.

Have a look to the QgsInterface class documentation to see all Qaction available : https://qgis.org/api/classQgisInterface.html

1

You use processing.runalg() (remember to import processing first) to call existing algorithms.

More detail and help in identifying the correct syntax for algorithms can be found in the QGIS documentation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.