Subgroup: other

Class: QgisInterface

class qgis.gui.QgisInterface

Bases: PyQt5.QtCore.QObject

Constructor

QgisInterface Abstract base class defining interfaces exposed by QgisApp and made available to plugins.

Only functionality exposed by QgisInterface can be used in plugins. This interface has to be implemented with application specific details.

QGIS implements it in QgisAppInterface class, 3rd party applications could provide their own implementation to be able to use plugins.

Methods

actionAbout
actionAddAfsLayer Get access to the native Add ArcGIS FeatureServer action.
actionAddAllToOverview
actionAddAmsLayer Get access to the native Add ArcGIS MapServer action.
actionAddFeature
actionAddOgrLayer
actionAddPart
actionAddPgLayer
actionAddRasterLayer
actionAddRing
actionAddToOverview
actionAddWmsLayer
actionAllEdits
actionCancelAllEdits
actionCancelEdits
actionCheckQgisVersion
actionCopyFeatures
actionCopyLayerStyle
actionCreatePrintLayout Create new print layout action
actionCustomProjection
actionCutFeatures
actionDeletePart
actionDeleteRing
actionDeleteSelected
actionDraw Get access to the native draw action.
actionDuplicateLayer
actionExit
actionFeatureAction Get access to the native run action feature action.
actionHelpContents
actionHideAllLayers
actionHideDeselectedLayers Returns the Hide Deselected Layers action.
actionHideSelectedLayers
actionIdentify Get access to the native identify action.
actionLayerProperties
actionLayerSaveAs
actionManagePlugins
actionMapTips Get access to the native map tips action.
actionMeasure Get access to the native measure action.
actionMeasureArea Get access to the native measure area action.
actionMoveFeature
actionNewBookmark Get access to the native new bookmark action.
actionNewProject
actionNewVectorLayer
actionOpenFieldCalculator
actionOpenProject
actionOpenStatisticalSummary Statistical summary action.
actionOpenTable
actionOptions
actionPan Get access to the native pan action.
actionPanToSelected Get access to the native pan to selected action.
actionPasteFeatures
actionPasteLayerStyle
actionPluginListSeparator
actionProjectProperties
actionQgisHomePage
actionRemoveAllFromOverview
actionRollbackAllEdits
actionRollbackEdits
actionSaveActiveLayerEdits
actionSaveAllEdits
actionSaveEdits
actionSaveMapAsImage
actionSaveProject
actionSaveProjectAs
actionSelect Get access to the native select action.
actionSelectFreehand Get access to the native select freehand action.
actionSelectPolygon Get access to the native select polygon action.
actionSelectRadius Get access to the native select radius action.
actionSelectRectangle Get access to the native select rectangle action.
actionShowAllLayers
actionShowBookmarks Get access to the native show bookmarks action.
actionShowLayoutManager Show layout manager action
actionShowPythonDialog
actionShowSelectedLayers
actionSimplifyFeature
actionSplitFeatures
actionSplitParts
actionToggleEditing
actionToggleFullScreen
actionVertexTool
actionZoomActualSize Get access to the native zoom resolution (100%) action.
actionZoomFullExtent Get access to the native zoom full extent action.
actionZoomIn Get access to the native zoom in action.
actionZoomLast Get access to the native zoom last action.
actionZoomNext Get access to the native zoom next action.
actionZoomOut Get access to the native zoom out action.
actionZoomToLayer Get access to the native zoom to layer action.
actionZoomToSelected Get access to the native zoom to selected action.
activeLayer Get pointer to the active layer (layer selected in the legend)
addCustomActionForLayer Add action to context menu for a specific layer in the layer tree.
addCustomActionForLayerType Add action to context menu for layers in the layer tree.
addDatabaseToolBarIcon Add an icon to the Database toolbar
addDatabaseToolBarWidget Add a widget to the database toolbar.
addDockWidget Add a dock widget to the main window
addLayerMenu .
addPluginToDatabaseMenu Add action to the Database menu
addPluginToMenu Add action to the plugins menu
addPluginToRasterMenu Add action to the Raster menu
addPluginToVectorMenu Add action to the Vector menu
addPluginToWebMenu Add action to the Web menu
addProject Add a project
addRasterLayer Add a raster layer given a raster layer file name
addRasterToolBarIcon Add an icon to the Raster toolbar
addRasterToolBarWidget Add a widget to the raster toolbar.
addToolBar Add toolbar with specified name
addToolBarIcon Add an icon to the plugins toolbar
addToolBarWidget Add a widget to the plugins toolbar.
addUserInputWidget Adds a widget to the user input tool bar.
addVectorLayer Add a vector layer
addVectorToolBarIcon Add an icon to the Vector toolbar
addVectorToolBarWidget Add a widget to the vector toolbar.
addWebToolBarIcon Add an icon to the Web toolbar
addWebToolBarWidget Add a widget to the web toolbar.
addWindow Add window to Window menu.
advancedDigitizeToolBar
askForDatumTransform Checks available datum transforms and ask user if several are available and none is chosen.
attributesToolBar
buildStyleSheet Generate stylesheet
cadDockWidget Advanced digitizing dock widget
childEvent
closeMapCanvas Closes the additional map canvas with matching name.
connectNotify
copySelectionToClipboard Copy selected features from the layer to clipboard
createNewMapCanvas Create a new map canvas with the specified unique name.
customEvent
databaseMenu
databaseToolBar
defaultStyleSheetFont Get reference font for initial qApp (may not be same as QgisApp)
defaultStyleSheetOptions Return changeable options built from settings and/or defaults
deregisterLocatorFilter Deregisters a locator filter from the app’s locator bar and deletes it.
digitizeToolBar
disconnectNotify
editMenu
editableLayers Return vector layers in edit mode
fileToolBar
firstRightStandardMenu
getFeatureForm Returns a feature form for a given feature
helpMenu
helpToolBar
iconSize Returns the toolbar icon size.
insertAddLayerAction Add “add layer” action to layer menu
isSignalConnected
layerMenu
layerToolBar
layerTreeCanvasBridge Returns a pointer to the layer tree canvas bridge
layerTreeView
mainWindow Return a pointer to the main window (instance of QgisApp in case of QGIS)
mapCanvas Return a pointer to the map canvas
mapCanvases Returns a list of all map canvases open in the app.
mapNavToolToolBar
messageBar Return the message bar of the main app
messageTimeout Get timeout for timed messages: default of 5 seconds
newLayerMenu
newProject Start a blank project
openFeatureForm Open feature form
openLayoutDesigner Opens a new layout designer dialog for the specified layout, or brings an already open designer window to the foreground if one is already created for the layout.
openLayoutDesigners Returns all currently open layout designers.
openMessageLog Open the message log dock widget *
openURL Open a url in the users browser.
pasteFromClipboard Paste features from clipboard to the layer
pluginManagerInterface
pluginMenu
pluginToolBar
preloadForm This method is only needed when using a UI form with a custom widget plugin and calling openFeatureForm or getFeatureForm from Python (PyQt4) and you haven’t used the info tool first.
projectMenu
rasterMenu
rasterToolBar
receivers
registerCustomDropHandler Register a new custom drop handler.
registerCustomLayoutDropHandler Register a new custom drop handler for layout windows.
registerLocatorFilter Registers a locator filter for the app’s locator bar.
registerMainWindowAction Register action to the shortcuts manager so its shortcut can be changed in GUI
registerMapLayerConfigWidgetFactory Register a new tab in the vector layer properties dialog.
registerOptionsWidgetFactory Register a new tab in the options dialog.
reloadConnections Triggered when connections have changed.
removeAddLayerAction Remove “add layer” action from layer menu
removeCustomActionForLayerType Remove action for layers in the layer tree previously added with addCustomActionForLayerType()
removeDatabaseToolBarIcon Remove an action (icon) from the Database toolbar
removeDockWidget Remove specified dock widget from main window (doesn’t delete it).
removePluginDatabaseMenu Remove action from the Database menu
removePluginMenu Remove action from the plugins menu
removePluginRasterMenu Remove action from the Raster menu
removePluginVectorMenu Remove action from the Vector menu
removePluginWebMenu Remove action from the Web menu
removeRasterToolBarIcon Remove an action (icon) from the Raster toolbar
removeToolBarIcon Remove an action (icon) from the plugin toolbar
removeVectorToolBarIcon Remove an action (icon) from the Vector toolbar
removeWebToolBarIcon Remove an action (icon) from the Web toolbar
removeWindow Remove window from Window menu.
saveStyleSheetOptions Save changed default option keys/values to user settings
sender
senderSignalIndex
setActiveLayer Set the active layer (layer gets selected in the legend) returns true if the layer exists, false otherwise
settingsMenu
shapeDigitizeToolBar
showAttributeTable Open attribute table dialog
showLayerProperties Open layer properties dialog
showLayoutManager Opens the layout manager dialog.
showOptionsDialog Opens the options dialog.
statusBarIface Returns a pointer to the app’s status bar interface.
timerEvent
unregisterCustomDropHandler Unregister a previously registered custom drop handler.
unregisterCustomLayoutDropHandler Unregister a previously registered custom drop handler for layout windows.
unregisterMainWindowAction Unregister a previously registered action.
unregisterMapLayerConfigWidgetFactory Unregister a previously registered tab in the vector layer properties dialog.
unregisterOptionsWidgetFactory Unregister a previously registered tab in the options dialog.
vectorLayerTools Access the vector layer tools instance.
vectorMenu
vectorToolBar
viewMenu
webMenu
webToolBar
windowMenu
zoomFull Zoom to full extent of map layers
zoomToActiveLayer Zoom to extent of the active layer
zoomToNext Zoom to next view extent
zoomToPrevious Zoom to previous view extent

Signals

currentLayerChanged Emitted whenever current (selected) layer changes.
currentThemeChanged Signal emitted when the current theme is changed so plugins can change their tool button icons.
initializationCompleted This signal is emitted when the initialization is complete [signal]
layerSavedAs This signal is emitted when a layer has been saved using save as note added in version 2.
layoutDesignerClosed This signal is emitted after a layout designer window is closed.
layoutDesignerOpened This signal is emitted when a new layout designer has been opened.
layoutDesignerWillBeClosed This signal is emitted before a layout designer is going to be closed and deleted.
newProjectCreated Emitted when starting an entirely new project note This is similar to projectRead(); plug-ins might want to be notified that they’re in a new project.
projectRead Emitted when a project file is successfully read note This is useful for plug-ins that store properties with project files.

Attributes

actionAbout(self) → QAction
actionAddAfsLayer(self) → QAction

Get access to the native Add ArcGIS FeatureServer action.

actionAddAllToOverview(self) → QAction
actionAddAmsLayer(self) → QAction

Get access to the native Add ArcGIS MapServer action.

actionAddFeature(self) → QAction
actionAddOgrLayer(self) → QAction
actionAddPart(self) → QAction
actionAddPgLayer(self) → QAction
actionAddRasterLayer(self) → QAction
actionAddRing(self) → QAction
actionAddToOverview(self) → QAction
actionAddWmsLayer(self) → QAction
actionAllEdits(self) → QAction
actionCancelAllEdits(self) → QAction
actionCancelEdits(self) → QAction
actionCheckQgisVersion(self) → QAction
actionCopyFeatures(self) → QAction
actionCopyLayerStyle(self) → QAction
actionCreatePrintLayout(self) → QAction

Create new print layout action

actionCustomProjection(self) → QAction
actionCutFeatures(self) → QAction
actionDeletePart(self) → QAction
actionDeleteRing(self) → QAction
actionDeleteSelected(self) → QAction
actionDraw(self) → QAction

Get access to the native draw action.

actionDuplicateLayer(self) → QAction
actionExit(self) → QAction
actionFeatureAction(self) → QAction

Get access to the native run action feature action. Call trigger() on it to set the default run feature action map tool.

actionHelpContents(self) → QAction
actionHideAllLayers(self) → QAction
actionHideDeselectedLayers(self) → QAction

Returns the Hide Deselected Layers action.

New in version 3.0.

actionHideSelectedLayers(self) → QAction
actionIdentify(self) → QAction

Get access to the native identify action. Call trigger() on it to set the default identify map tool.

actionLayerProperties(self) → QAction
actionLayerSaveAs(self) → QAction
actionManagePlugins(self) → QAction
actionMapTips(self) → QAction

Get access to the native map tips action. Call trigger() on it to toggle map tips.

actionMeasure(self) → QAction

Get access to the native measure action. Call trigger() on it to set the default measure map tool.

actionMeasureArea(self) → QAction

Get access to the native measure area action. Call trigger() on it to set the default measure area map tool.

actionMoveFeature(self) → QAction
actionNewBookmark(self) → QAction

Get access to the native new bookmark action. Call trigger() on it to open the new bookmark dialog.

actionNewProject(self) → QAction
actionNewVectorLayer(self) → QAction
actionOpenFieldCalculator(self) → QAction
actionOpenProject(self) → QAction
actionOpenStatisticalSummary(self) → QAction

Statistical summary action.

New in version 3.0.

actionOpenTable(self) → QAction
actionOptions(self) → QAction
actionPan(self) → QAction

Get access to the native pan action. Call trigger() on it to set the default pan map tool.

actionPanToSelected(self) → QAction

Get access to the native pan to selected action. Call trigger() on it to pan the map canvas to the selection.

actionPasteFeatures(self) → QAction
actionPasteLayerStyle(self) → QAction
actionPluginListSeparator(self) → QAction
actionProjectProperties(self) → QAction
actionQgisHomePage(self) → QAction
actionRemoveAllFromOverview(self) → QAction
actionRollbackAllEdits(self) → QAction
actionRollbackEdits(self) → QAction
actionSaveActiveLayerEdits(self) → QAction
actionSaveAllEdits(self) → QAction
actionSaveEdits(self) → QAction
actionSaveMapAsImage(self) → QAction
actionSaveProject(self) → QAction
actionSaveProjectAs(self) → QAction
actionSelect(self) → QAction

Get access to the native select action. Call trigger() on it to set the default select map tool.

actionSelectFreehand(self) → QAction

Get access to the native select freehand action. Call trigger() on it to set the default select freehand map tool.

actionSelectPolygon(self) → QAction

Get access to the native select polygon action. Call trigger() on it to set the default select polygon map tool.

actionSelectRadius(self) → QAction

Get access to the native select radius action. Call trigger() on it to set the default select radius map tool.

actionSelectRectangle(self) → QAction

Get access to the native select rectangle action. Call trigger() on it to set the default select rectangle map tool.

actionShowAllLayers(self) → QAction
actionShowBookmarks(self) → QAction

Get access to the native show bookmarks action. Call trigger() on it to open the bookmarks dialog.

actionShowLayoutManager(self) → QAction

Show layout manager action

actionShowPythonDialog(self) → QAction
actionShowSelectedLayers(self) → QAction
actionSimplifyFeature(self) → QAction
actionSplitFeatures(self) → QAction
actionSplitParts(self) → QAction
actionToggleEditing(self) → QAction
actionToggleFullScreen(self) → QAction
actionVertexTool(self) → QAction
actionZoomActualSize(self) → QAction

Get access to the native zoom resolution (100%) action. Call trigger() on it to zoom to actual size.

actionZoomFullExtent(self) → QAction

Get access to the native zoom full extent action. Call trigger() on it to zoom to the full extent.

actionZoomIn(self) → QAction

Get access to the native zoom in action. Call trigger() on it to set the default zoom in map tool.

actionZoomLast(self) → QAction

Get access to the native zoom last action. Call trigger() on it to zoom to last.

actionZoomNext(self) → QAction

Get access to the native zoom next action. Call trigger() on it to zoom to next.

actionZoomOut(self) → QAction

Get access to the native zoom out action. Call trigger() on it to set the default zoom out map tool.

actionZoomToLayer(self) → QAction

Get access to the native zoom to layer action. Call trigger() on it to zoom to the active layer.

actionZoomToSelected(self) → QAction

Get access to the native zoom to selected action. Call trigger() on it to zoom to the current selection.

activeLayer(self) → QgsMapLayer

Get pointer to the active layer (layer selected in the legend)

addCustomActionForLayer(self, action: QAction, layer: QgsMapLayer)

Add action to context menu for a specific layer in the layer tree. It is necessary to first call addCustomActionForLayerType() with allLayers=false in order for this method to have any effect.

addCustomActionForLayerType(self, action: QAction, menu: str, type: QgsMapLayer.LayerType, allLayers: bool)

Add action to context menu for layers in the layer tree. If allLayers is true, then the action will be available for all layers of given type, otherwise the action will be available only for specific layers added with addCustomActionForLayer() after this call.

If menu argument is not empty, the action will be also added to a menu within the main window, creating menu with the given name if it does not exist yet.

addDatabaseToolBarIcon(self, qAction: QAction) → int

Add an icon to the Database toolbar

addDatabaseToolBarWidget(self, widget: QWidget) → QAction

Add a widget to the database toolbar. To remove this widget again, call removeDatabaseToolBarIcon() with the returned QAction.

Parameters:widget – widget to add. The toolbar will take ownership of this widget
Returns:the QAction you can use to remove this widget from the toolbar
addDockWidget(self, area: Qt.DockWidgetArea, dockwidget: QDockWidget)

Add a dock widget to the main window

addLayerMenu(self) → QMenu

New in version 2.5.

addPluginToDatabaseMenu(self, name: str, action: QAction)

Add action to the Database menu

addPluginToMenu(self, name: str, action: QAction)

Add action to the plugins menu

addPluginToRasterMenu(self, name: str, action: QAction)

Add action to the Raster menu

addPluginToVectorMenu(self, name: str, action: QAction)

Add action to the Vector menu

addPluginToWebMenu(self, name: str, action: QAction)

Add action to the Web menu

addProject(self, project: str) → bool

Add a project

addRasterLayer(self, rasterLayerPath: str, baseName: str = '') → QgsRasterLayer

Add a raster layer given a raster layer file name

addRasterLayer(self, url: str, layerName: str, providerKey: str) -> QgsRasterLayer Add a WMS layer

addRasterToolBarIcon(self, qAction: QAction) → int

Add an icon to the Raster toolbar

addRasterToolBarWidget(self, widget: QWidget) → QAction

Add a widget to the raster toolbar. To remove this widget again, call removeRasterToolBarIcon() with the returned QAction.

Parameters:widget – widget to add. The toolbar will take ownership of this widget
Returns:the QAction you can use to remove this widget from the toolbar
addToolBar(self, name: str) → QToolBar

Add toolbar with specified name

addToolBar(self, toolbar: QToolBar, area: Qt.ToolBarArea = Qt.TopToolBarArea) Add a toolbar

New in version 2.3.

addToolBarIcon(self, qAction: QAction) → int

Add an icon to the plugins toolbar

addToolBarWidget(self, widget: QWidget) → QAction

Add a widget to the plugins toolbar. To remove this widget again, call removeToolBarIcon() with the returned QAction.

Parameters:widget – widget to add. The toolbar will take ownership of this widget
Returns:the QAction you can use to remove this widget from the toolbar
addUserInputWidget(self, widget: QWidget)

Adds a widget to the user input tool bar.

addVectorLayer(self, vectorLayerPath: str, baseName: str, providerKey: str) → QgsVectorLayer

Add a vector layer

addVectorToolBarIcon(self, qAction: QAction) → int

Add an icon to the Vector toolbar

addVectorToolBarWidget(self, widget: QWidget) → QAction

Add a widget to the vector toolbar. To remove this widget again, call removeVectorToolBarIcon() with the returned QAction.

Parameters:widget – widget to add. The toolbar will take ownership of this widget
Returns:the QAction you can use to remove this widget from the toolbar
addWebToolBarIcon(self, qAction: QAction) → int

Add an icon to the Web toolbar

addWebToolBarWidget(self, widget: QWidget) → QAction

Add a widget to the web toolbar. To remove this widget again, call removeWebToolBarIcon() with the returned QAction.

Parameters:widget – widget to add. The toolbar will take ownership of this widget
Returns:the QAction you can use to remove this widget from the toolbar
addWindow(self, action: QAction)

Add window to Window menu. The action title is the window title and the action should raise, unminimize and activate the window. *

advancedDigitizeToolBar(self) → QToolBar
askForDatumTransform(self, sourceCrs: QgsCoordinateReferenceSystem, destinationCrs: QgsCoordinateReferenceSystem) → bool

Checks available datum transforms and ask user if several are available and none is chosen. Dialog is shown only if global option is set accordingly.

Returns:true if a datum transform has been specifically chosen by user or only one is available.

New in version 3.0.

attributesToolBar(self) → QToolBar
buildStyleSheet(self, opts: Dict[str, Any])

Generate stylesheet

Parameters:opts – generated default option values, or a changed copy of them
cadDockWidget(self) → QgsAdvancedDigitizingDockWidget

Advanced digitizing dock widget

New in version 2.12.

childEvent()
closeMapCanvas(self, name: str)

Closes the additional map canvas with matching name.

New in version 3.0.

connectNotify()
copySelectionToClipboard(self, QgsMapLayer)

Copy selected features from the layer to clipboard

New in version 3.0.

createNewMapCanvas(self, name: str) → QgsMapCanvas

Create a new map canvas with the specified unique name.

New in version 3.0.

See also

closeMapCanvas()

currentLayerChanged

Emitted whenever current (selected) layer changes. The pointer to layer can be null if no layer is selected [signal]

currentThemeChanged

Signal emitted when the current theme is changed so plugins can change their tool button icons.

New in version 3.0: [signal]

customEvent()
databaseMenu(self) → QMenu
databaseToolBar(self) → QToolBar
defaultStyleSheetFont(self) → QFont

Get reference font for initial qApp (may not be same as QgisApp)

defaultStyleSheetOptions(self) → Dict[str, Any]

Return changeable options built from settings and/or defaults

deregisterLocatorFilter(self, filter: QgsLocatorFilter)

Deregisters a locator filter from the app’s locator bar and deletes it. Calling this will block whilst any currently running query is terminated.

Plugins which register filters to the locator bar must take care to correctly call deregisterLocatorFilter() to deregister their filters upon plugin unload to avoid crashes.

New in version 3.0.

digitizeToolBar(self) → QToolBar
disconnectNotify()
editMenu(self) → QMenu
editableLayers(self, modified: bool = False) → List[QgsMapLayer]

Return vector layers in edit mode

Parameters:modified – whether to return only layers that have been modified
Returns:list of layers in legend order, or empty list *
fileToolBar(self) → QToolBar
firstRightStandardMenu(self) → QMenu
getFeatureForm(self, l: QgsVectorLayer, f: QgsFeature) → QgsAttributeDialog

Returns a feature form for a given feature

Parameters:
  • l – The layer for which the dialog will be created
  • f – The feature for which the dialog will be created
Returns:

A feature form

helpMenu(self) → QMenu
helpToolBar(self) → QToolBar
iconSize(self, dockedToolbar: bool = False) → QSize

Returns the toolbar icon size. If dockedToolbar is true, the icon size for toolbars contained within docks is returned.

initializationCompleted

This signal is emitted when the initialization is complete [signal]

insertAddLayerAction(self, action: QAction)

Add “add layer” action to layer menu

isSignalConnected()
layerMenu(self) → QMenu
layerSavedAs

This signal is emitted when a layer has been saved using save as note added in version 2.7 [signal]

layerToolBar(self) → QToolBar
layerTreeCanvasBridge(self) → QgsLayerTreeMapCanvasBridge

Returns a pointer to the layer tree canvas bridge

New in version 2.12.

layerTreeView(self) → QgsLayerTreeView
layoutDesignerClosed

This signal is emitted after a layout designer window is closed.

New in version 3.0.

See also

layoutDesignerOpened() [signal]

layoutDesignerOpened

This signal is emitted when a new layout designer has been opened.

New in version 3.0.

See also

layoutDesignerWillBeClosed() [signal]

layoutDesignerWillBeClosed

This signal is emitted before a layout designer is going to be closed and deleted.

New in version 3.0.

See also

layoutDesignerOpened() [signal]

mainWindow(self) → QWidget

Return a pointer to the main window (instance of QgisApp in case of QGIS)

mapCanvas(self) → QgsMapCanvas

Return a pointer to the map canvas

mapCanvases(self) → object

Returns a list of all map canvases open in the app.

New in version 3.0.

mapNavToolToolBar(self) → QToolBar
messageBar(self) → QgsMessageBar

Return the message bar of the main app

messageTimeout(self) → int

Get timeout for timed messages: default of 5 seconds

newLayerMenu(self) → QMenu
newProject(self, promptToSaveFlag: bool = False)

Start a blank project

newProjectCreated

Emitted when starting an entirely new project note This is similar to projectRead(); plug-ins might want to be notified that they’re in a new project. Yes, projectRead() could have been overloaded to be used in the case of new projects instead. However, it’s probably more semantically correct to have an entirely separate signal for when this happens. [signal]

openFeatureForm(self, l: QgsVectorLayer, f: QgsFeature, updateFeatureOnly: bool = False, showModal: bool = True) → bool

Open feature form

Parameters:
  • l – vector layer
  • f – feature to show/modify
  • updateFeatureOnly – only update the feature update (don’t change any attributes of the layer) [UNUSED]
  • showModal – if true, will wait for the dialog to be executed (only shown otherwise)
openLayoutDesigner(self, layout: QgsMasterLayoutInterface) → QgsLayoutDesignerInterface

Opens a new layout designer dialog for the specified layout, or brings an already open designer window to the foreground if one is already created for the layout.

New in version 3.0.

openLayoutDesigners(self) → object

Returns all currently open layout designers.

New in version 3.0.

openMessageLog(self)

Open the message log dock widget *

openURL(self, url: str, useQgisDocDirectory: bool = True)

Open a url in the users browser. By default the QGIS doc directory is used as the base for the URL. To open a URL that is not relative to the installed QGIS documentation, set useQgisDocDirectory to false.

Parameters:
  • url – URL to open
  • useQgisDocDirectory – If true, the URL will be formed by concatenating

url to the QGIS documentation directory path (prefix/share/doc) deprecated

pasteFromClipboard(self, QgsMapLayer)

Paste features from clipboard to the layer

New in version 3.0.

pluginManagerInterface(self) → QgsPluginManagerInterface
pluginMenu(self) → QMenu
pluginToolBar(self) → QToolBar
preloadForm(self, uifile: str)

This method is only needed when using a UI form with a custom widget plugin and calling openFeatureForm or getFeatureForm from Python (PyQt4) and you haven’t used the info tool first. Python will crash bringing QGIS with it if the custom form is not loaded from a C++ method call.

This method uses a QTimer to call QUiLoader in order to load the form via C++ you only need to call this once after that you can call openFeatureForm/getFeatureForm like normal

More information here: http://qt-project.org/forums/viewthread/27098

projectMenu(self) → QMenu
projectRead

Emitted when a project file is successfully read note This is useful for plug-ins that store properties with project files. A plug-in can connect to this signal. When it is emitted, the plug-in knows to then check the project properties for any relevant state. [signal]

rasterMenu(self) → QMenu
rasterToolBar(self) → QToolBar
receivers()
registerCustomDropHandler(self, handler: QgsCustomDropHandler)

Register a new custom drop handler.

New in version 3.0.

Note

Ownership of the factory is not transferred, and the factory must be unregistered when plugin is unloaded.

registerCustomLayoutDropHandler(self, handler: QgsLayoutCustomDropHandler)

Register a new custom drop handler for layout windows.

New in version 3.0.

Note

Ownership of the factory is not transferred, and the factory must be unregistered when plugin is unloaded.

registerLocatorFilter(self, filter: QgsLocatorFilter)

Registers a locator filter for the app’s locator bar. Ownership of the filter is transferred to the locator.

Warning

Plugins which register filters to the locator bar must take care to correctly call deregisterLocatorFilter() and deregister their filters upon plugin unload to avoid crashes.

New in version 3.0.

registerMainWindowAction(self, action: QAction, defaultShortcut: str) → bool

Register action to the shortcuts manager so its shortcut can be changed in GUI

registerMapLayerConfigWidgetFactory(self, factory: QgsMapLayerConfigWidgetFactory)

Register a new tab in the vector layer properties dialog.

New in version 2.16.

Note

Ownership of the factory is not transferred, and the factory must be unregistered when plugin is unloaded.

See also

unregisterMapLayerPropertiesFactory()

registerOptionsWidgetFactory(self, factory: QgsOptionsWidgetFactory)

Register a new tab in the options dialog.

New in version 3.0.

Note

Ownership of the factory is not transferred, and the factory must be unregistered when plugin is unloaded.

reloadConnections(self)

Triggered when connections have changed. This calls reloadConnections in the main application and triggers a signal that is forwarded to the GUI elements that needs to be updated (i.e. the source select dialogs and the browser widgets)

New in version 3.0.

removeAddLayerAction(self, action: QAction)

Remove “add layer” action from layer menu

removeCustomActionForLayerType(self, action: QAction) → bool

Remove action for layers in the layer tree previously added with addCustomActionForLayerType()

removeDatabaseToolBarIcon(self, qAction: QAction)

Remove an action (icon) from the Database toolbar

removeDockWidget(self, dockwidget: QDockWidget)

Remove specified dock widget from main window (doesn’t delete it).

removePluginDatabaseMenu(self, name: str, action: QAction)

Remove action from the Database menu

removePluginMenu(self, name: str, action: QAction)

Remove action from the plugins menu

removePluginRasterMenu(self, name: str, action: QAction)

Remove action from the Raster menu

removePluginVectorMenu(self, name: str, action: QAction)

Remove action from the Vector menu

removePluginWebMenu(self, name: str, action: QAction)

Remove action from the Web menu

removeRasterToolBarIcon(self, qAction: QAction)

Remove an action (icon) from the Raster toolbar

removeToolBarIcon(self, qAction: QAction)

Remove an action (icon) from the plugin toolbar

removeVectorToolBarIcon(self, qAction: QAction)

Remove an action (icon) from the Vector toolbar

removeWebToolBarIcon(self, qAction: QAction)

Remove an action (icon) from the Web toolbar

removeWindow(self, action: QAction)

Remove window from Window menu. Calling this is necessary only for windows which are hidden rather than deleted when closed. *

saveStyleSheetOptions(self, opts: Dict[str, Any])

Save changed default option keys/values to user settings

sender()
senderSignalIndex()
setActiveLayer(self, QgsMapLayer) → bool

Set the active layer (layer gets selected in the legend) returns true if the layer exists, false otherwise

settingsMenu(self) → QMenu
shapeDigitizeToolBar(self) → QToolBar
showAttributeTable(self, l: QgsVectorLayer, filterExpression: str = '') → QDialog

Open attribute table dialog

showLayerProperties(self, l: QgsMapLayer)

Open layer properties dialog

showLayoutManager(self)

Opens the layout manager dialog.

New in version 3.0.

showOptionsDialog(self, parent: QWidget = None, currentPage: str = '')

Opens the options dialog. The currentPage argument can be used to force the dialog to open at a specific page.

New in version 3.0.

statusBarIface(self) → QgsStatusBar

Returns a pointer to the app’s status bar interface. This should be used for interacting and adding widgets and messages to the app’s status bar (do not use the native Qt statusBar() method).

New in version 3.0.

timerEvent()
unregisterCustomDropHandler(self, handler: QgsCustomDropHandler)

Unregister a previously registered custom drop handler.

New in version 3.0.

unregisterCustomLayoutDropHandler(self, handler: QgsLayoutCustomDropHandler)

Unregister a previously registered custom drop handler for layout windows.

New in version 3.0.

unregisterMainWindowAction(self, action: QAction) → bool

Unregister a previously registered action. (e.g. when plugin is going to be unloaded)

unregisterMapLayerConfigWidgetFactory(self, factory: QgsMapLayerConfigWidgetFactory)

Unregister a previously registered tab in the vector layer properties dialog.

New in version 2.16.

See also

registerMapLayerPropertiesFactory()

unregisterOptionsWidgetFactory(self, factory: QgsOptionsWidgetFactory)

Unregister a previously registered tab in the options dialog.

New in version 3.0.

vectorLayerTools(self) → QgsVectorLayerTools

Access the vector layer tools instance. With the help of this you can access methods like addFeature, startEditing or stopEditing while giving the user the appropriate dialogs.

Returns:An instance of the vector layer tools
vectorMenu(self) → QMenu
vectorToolBar(self) → QToolBar
viewMenu(self) → QMenu
webMenu(self) → QMenu
webToolBar(self) → QToolBar
windowMenu(self) → QMenu
zoomFull(self)

Zoom to full extent of map layers

zoomToActiveLayer(self)

Zoom to extent of the active layer

zoomToNext(self)

Zoom to next view extent

zoomToPrevious(self)

Zoom to previous view extent