class documentation

class QgisInterface(QObject):

View In Hierarchy

Class to expose QGIS objects and functions to plugins.

This class is here for enabling us to run unit tests only, so most methods are simply stubs.

Method __init__ Constructor :param canvas:
Method active​Layer Get pointer to the active layer (layer selected in the legend).
Method add​Dock​Widget Add a dock widget to the main window.
Method add​Layer Handle a layer being added to the registry so it shows up in canvas.
Method add​Layers Handle layers being added to the registry so they show up in canvas.
Method add​Raster​Layer Add a raster layer given a raster layer file name
Method add​Tool​Bar Add toolbar with specified name.
Method add​Tool​Bar​Icon Add an icon to the plugins toolbar.
Method add​Vector​Layer Add a vector layer.
Method legend​Interface Get the legend.
Method main​Window Return a pointer to the main window.
Method map​Canvas Return a pointer to the map canvas.
Method new​Project Create new project.
Method remove​All​Layers Remove layers from the canvas before they get deleted.
Method remove​Tool​Bar​Icon Remove an action (icon) from the plugin toolbar.
Method zoom​Full Zoom to the map full extent.
Method zoom​To​Active​Layer Zoom to extent of active layer.
Method zoom​To​Next Zoom to next view extent.
Method zoom​To​Previous Zoom to previous view extent.
Class Variable current​Layer​Changed Undocumented
Instance Variable canvas Undocumented
Instance Variable dest​Crs Undocumented
def __init__(self, canvas):
Constructor :param canvas:
def activeLayer(self):
Get pointer to the active layer (layer selected in the legend).
def addDockWidget(self, area, dock_widget):

Add a dock widget to the main window.

:param area: Where in the ui the dock should be placed. :type area:

:param dock_widget: A dock widget to add to the UI. :type dock_widget: QDockWidget

@pyqtSlot('QgsMapLayer')
def addLayer(self, layer):
@pyqtSlot('QStringList')
def addLayers(self, layers):
def addRasterLayer(self, path, base_name):

Add a raster layer given a raster layer file name

:param path: Path to layer. :type path: str

:param base_name: Base name for layer. :type base_name: str

def addToolBar(self, name):

Add toolbar with specified name.

:param name: Name for the toolbar. :type name: str

def addToolBarIcon(self, action):

Add an icon to the plugins toolbar.

:param action: Action to add to the toolbar. :type action: QAction

def addVectorLayer(self, path, base_name, provider_key):

Add a vector layer.

:param path: Path to layer. :type path: str

:param base_name: Base name for layer. :type base_name: str

:param provider_key: Provider key e.g. 'ogr' :type provider_key: str

def legendInterface(self):
Get the legend.
def mainWindow(self):

Return a pointer to the main window.

In case of QGIS it returns an instance of QgisApp.

def mapCanvas(self):
Return a pointer to the map canvas.
def newProject(self):
Create new project.
@pyqtSlot()
def removeAllLayers(self):
Remove layers from the canvas before they get deleted.
def removeToolBarIcon(self, action):

Remove an action (icon) from the plugin toolbar.

:param action: Action to add to the toolbar. :type action: QAction

def zoomFull(self):
Zoom to the map full extent.
def zoomToActiveLayer(self):
Zoom to extent of active layer.
def zoomToNext(self):
Zoom to next view extent.
def zoomToPrevious(self):
Zoom to previous view extent.
currentLayerChanged =

Undocumented

canvas =

Undocumented

destCrs =

Undocumented