QgsVectorLayer* layer = new QgsVectorLayer("/path/to/shapefile.shp", "Layer name", "ogr"); if (layer->isEditable()) { // do something }
QgsVectorLayer* layer = new QgsVectorLayer("/path/to/shapefile.shp", "Layer name", "ogr"); layer->startEditing();This example creates a new QgsVectorLayer object representing a shapefile and starts editing mode by invoking the startEditing function. Package library: QGIS Library.