i want to create a QGIS action which copies features between two points layers using pyqgis .
i have read How to create a QGIS action which copies features between layers? and i try to use this code:
# only QGIS < 2.0 iface = qgis.utils.iface # Make the source layer active iface.setActiveLayer( sourceLayer ) # Set the selection on the source layer (Could also be done manually with the selection tools sourceLayer.setSelectedFeatures( [ 1, 5, 10 ] ) # Copy iface.actionCopyFeatures().trigger() # Set destination layer active iface.setActiveLayer( destinationLayer ) # Turn on editing on destination layer, so we can paste destinationLayer.startEditing() # Paste features iface.actionPasteFeatures().trigger() # Uncomment to automatically save edits # destinationLayer.commitChanges()
but in my case i dont need to copy selected features but i need to copy all features from sourceLayer to destinationLayer,and i need to transfer common attributes from sourceLayer to destinationLayer .
What changes do I need in this code?