Features to stay selected by default in QGIS?
I believe @artwork21 is correct in that you will have to edit the signal when adding a feature in order to select it. But you don't need to create a plugin, you can copy/paste the following code into the Python Console which, for your selected layer, selects the newly created feature each time:
layer = qgis.utils.iface.activeLayer()
# Use active layer
def select(featureAdded):
layer.setSelectedFeatures([featureAdded])
layer.featureAdded.connect(select)
# Connect "featureAdded" event to "select" function
Tested using QGIS 2.12.3-Lyon.
Creating polygon:
Finished creating polygon and selected automatically:
EDIT:
In response to the comments, you can load the project which runs the code on startup by adding a Project macro which can be accessed from the toolbar:
Project > Project Properties > Macros
Note that the code will only work on a specific layer, therefore you can define the name of the layer you want the code to be applied to:
import qgis
from qgis.core import QgsMapLayerRegistry
def select(featureAdded):
layer.setSelectedFeatures([featureAdded])
for layer in QgsMapLayerRegistry.instance().mapLayers().values():
if layer.name() == "LAYER_NAME":
qgis.utils.iface.setActiveLayer(layer)
layer = qgis.utils.iface.activeLayer()
layer.featureAdded.connect(select)
Make sure to save the project and enable macros by going to the toolbar:
Settings > General > Enable macros
I'm not sure that property exists within the QGIS UI. You may have to write a pyqgis plugin to listen for an edit signal, get the newly created feature id, and select that feature.
Here is the API link for the pyqgis edit signals. There are many different posts on this site and other websites for creating a plugin, getting vector feature id, and selecting feature based on id using pyqgis.