I'm using QGIS 2.2.0. I add a vector to a vector layer and save the file. After I reopen the .qgs file, the new vector is not shown.
(1) Click 'Toggle Editing'
(2) Click 'Add Feature' and draw a polyline.
(3) Click 'Save Layer Edits'
(4) Click 'Save'
layer = QgsVectorLayer('LineString', 'my line' , 'memory')
andQgsMapLayerRegistry.instance().addMapLayers([layer])
– wannik Jun 16 '14 at 1:04