Nice example

I like this tutorial, many thanks to Francis for creating it and also to Tim for adding more comments.

I just miss some cleanup here - before exiting you should remove layers from registry (AFAIK it's not done automatically):

QgsMapLayerRegistry::instance()->removeAllMapLayers();

Also QgsMapCanvas doesn't get deleted, probably easier way is to use it as a local variable, e.g.

QgsMapCanvas myMapCanvas(0, 0);

Reply