Adapting for QGIS API v2