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

rtype

QAction

actionAddAfsLayer

Returns the native Add ArcGIS FeatureServer action.

actionAddAllToOverview

rtype

QAction

actionAddAmsLayer

Returns the native Add ArcGIS MapServer action.

actionAddFeature

Returns the native Add Feature action.

actionAddOgrLayer

rtype

QAction

actionAddPart

Returns the native Add Part action.

actionAddPgLayer

rtype

QAction

actionAddRasterLayer

rtype

QAction

actionAddRing

Returns the native Add Ring action.

actionAddToOverview

rtype

QAction

actionAddVectorTileLayer

Returns the native Add Vector Tile Layer action.

actionAddWmsLayer

rtype

QAction

actionAddXyzLayer

Returns the native Add XYZ Layer action.

actionAllEdits

rtype

QAction

actionCancelAllEdits

rtype

QAction

actionCancelEdits

rtype

QAction

actionCheckQgisVersion

rtype

QAction

actionCircle2Points

Returns the native add circle from 2 points action.

actionCircle2TangentsPoint

Returns the native add circle from 2 tangents and a point action.

actionCircle3Points

Returns the native add circle from 3 points action.

actionCircle3Tangents

Returns the native add circle from 3 tangents action.

actionCircleCenterPoint

Returns the native add circle from center action.

actionCopyFeatures

Returns the native Copy Features action.

actionCopyLayerStyle

rtype

QAction

actionCreatePrintLayout

Create new print layout action

actionCustomProjection

rtype

QAction

actionCutFeatures

Returns the native Cut Features action.

actionDeletePart

Returns the native Delete Part action.

actionDeleteRing

Returns the native Delete Ring action.

actionDeleteSelected

Returns the native Delete Selected Features action.

actionDraw

Returns the native draw action.

actionDuplicateLayer

rtype

QAction

actionEllipseCenter2Points

Returns the native add ellipse from center and 2 points action.

actionEllipseCenterPoint

Returns the native add ellipse from center and a point action.

actionEllipseExtent

Returns the native add ellipse from an extent action.

actionEllipseFoci

Returns the native add ellipse from foci action.

actionExit

Returns the Exit QGIS action.

actionFeatureAction

Returns the native run action feature action.

actionHelpContents

rtype

QAction

actionHideAllLayers

rtype

QAction

actionHideDeselectedLayers

Returns the Hide Deselected Layers action.

actionHideSelectedLayers

rtype

QAction

actionIdentify

Returns the native identify action.

actionLayerProperties

rtype

QAction

actionLayerSaveAs

rtype

QAction

actionManagePlugins

rtype

QAction

actionMapTips

Returns the native map tips action.

actionMeasure

Returns the native measure action.

actionMeasureArea

Returns the native measure area action.

actionMoveFeature

Returns the native Move Features action.

actionNewBookmark

Returns the native new bookmark action.

actionNewProject

Returns the native New Project action.

actionNewVectorLayer

rtype

QAction

actionOpenFieldCalculator

rtype

QAction

actionOpenProject

Returns the Open Project action.

actionOpenStatisticalSummary

Statistical summary action.

actionOpenTable

rtype

QAction

actionOptions

rtype

QAction

actionPan

Returns the native pan action.

actionPanToSelected

Returns the native pan to selected action.

actionPasteFeatures

Returns the native Paste Features action.

actionPasteLayerStyle

rtype

QAction

actionPluginListSeparator

rtype

QAction

actionProjectProperties

Returns the native Project Properties action.

actionQgisHomePage

rtype

QAction

actionRectangle3PointsDistance

Returns the native add rectangle from 3 points (distance from 2nd and 3rd points) action.

actionRectangle3PointsProjected

Returns the native add rectangle from 3 points (distance from projected 3rd point on segment p1 and p2) action.

actionRectangleCenterPoint

Returns the native add rectangle from center and a point action.

actionRectangleExtent

Returns the native add rectangle from extent action.

actionRegularPolygon2Points

Returns the native add regular polygon from 2 points action.

actionRegularPolygonCenterCorner

Returns the native add regular polygon from center and a corner action.

actionRegularPolygonCenterPoint

Returns the native add regular polygon from center and a point action.

actionRemoveAllFromOverview

rtype

QAction

actionRollbackAllEdits

rtype

QAction

actionRollbackEdits

rtype

QAction

actionSaveActiveLayerEdits

rtype

QAction

actionSaveAllEdits

rtype

QAction

actionSaveEdits

rtype

QAction

actionSaveMapAsImage

Returns the native Save Map as Image action.

actionSaveProject

Returns the native Save Project action.

actionSaveProjectAs

Returns the native Save Project As action.

actionSelect

Returns the native select action.

actionSelectFreehand

Returns the native select freehand action.

actionSelectPolygon

Returns the native select polygon action.

actionSelectRadius

Returns the native select radius action.

actionSelectRectangle

Returns the native select rectangle action.

actionShowAllLayers

rtype

QAction

actionShowBookmarks

Returns the native show bookmarks action.

actionShowLayoutManager

Show layout manager action

actionShowPythonDialog

rtype

QAction

actionShowSelectedLayers

rtype

QAction

actionSimplifyFeature

Returns the native Simplify/Smooth Features action.

actionSplitFeatures

Returns the native Split Features action.

actionSplitParts

Returns the native Split Parts action.

actionToggleEditing

rtype

QAction

actionToggleFullScreen

rtype

QAction

actionToggleSelectedLayers

Returns the Toggle Selected Layers action.

actionToggleSelectedLayersIndependently

Returns the Toggle Selected Layers Independently action.

actionVertexTool

Returns the native "Vertex Tool for All Layers" action.

actionVertexToolActiveLayer

Returns the native "Vertex Tool for Active Layer" action.

actionZoomActualSize

Returns the native zoom resolution (100%) action.

actionZoomFullExtent

Returns the native zoom full extent action.

actionZoomIn

Returns the native zoom in action.

actionZoomLast

Returns the native zoom last action.

actionZoomNext

Returns the native zoom next action.

actionZoomOut

Returns the native zoom out action.

actionZoomToLayer

Returns the native zoom to layer action.

actionZoomToSelected

Returns the native zoom to selected action.

activeLayer

Returns a 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

Adds a dock widget to the main window, in the specified dock area.

addLayerMenu

Returns a reference to the main window "Add Layer" menu.

addMeshLayer

Adds a mesh layer to the current project.

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

Adds (opens) a project

addRasterLayer

Adds a raster layer to the current project, given a raster layer file name.

addRasterToolBarIcon

Add an icon to the Raster toolbar

addRasterToolBarWidget

Add a widget to the raster toolbar.

addTabifiedDockWidget

Add a dock widget to the given area and tabify it (if other dock widgets exist in the same area).

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

Adds a vector layer to the current project.

addVectorTileLayer

Adds a vector tile layer to the current project.

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

Returns a reference to the main window "Advanced Digitizing" toolbar.

askForDatumTransform

Checks available datum transforms and ask user if several are available and none is chosen.

attributesToolBar

Returns a reference to the main window "Attributes" toolbar.

browserModel

Returns the application browser model.

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

dataSourceManagerToolBar

Returns a reference to the main window "Data Source Manager" toolbar.

databaseMenu

Returns a reference to the main window "Database" menu.

databaseToolBar

Returns a reference to the main window "Database" toolbar.

defaultStyleSheetFont

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

defaultStyleSheetOptions

Returns changeable options built from settings and/or defaults

deregisterLocatorFilter

Deregisters a locator filter from the app's locator bar and deletes it.

digitizeToolBar

Returns a reference to the main window "Digitize" toolbar.

disconnectNotify

editMenu

Returns a reference to the main window "Edit" menu.

editableLayers

Returns vector layers in edit mode

fileToolBar

Returns a reference to the main window "File" toolbar.

firstRightStandardMenu

Returns a reference to the right most standard menu, which is usually the last menu item before the "Help" menu.

getFeatureForm

Returns a feature form for a given feature.

helpMenu

Returns a reference to the main window "Help" menu.

helpToolBar

Returns a reference to the main window "Help" toolbar.

iconSize

Returns the toolbar icon size.

insertAddLayerAction

Add "add layer" action to layer menu

invalidateLocatorResults

Invalidate results from the locator filter.

isSignalConnected

layerMenu

Returns a reference to the main window "Layer" menu.

layerToolBar

Returns a reference to the main window "Layer" toolbar.

layerTreeCanvasBridge

Returns a pointer to the layer tree canvas bridge

layerTreeInsertionPoint

Returns the insertion point.

layerTreeView

rtype

QgsLayerTreeView

locatorSearch

This will perform a search in the locator bar by setting the line edit text to searchText and automatically displaying any results.

mainWindow

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

mapCanvas

Returns a pointer to the map canvas

mapCanvases

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

mapNavToolToolBar

Returns a reference to the main window "Map Navigation" toolbar.

mapToolActionGroup

Returns the action group for map tools.

messageBar

Returns the message bar of the main app

messageTimeout

Returns the timeout for timed messages: default of 5 seconds

newLayerMenu

Returns a reference to the main window "Create New Layer" menu.

newProject

Starts a new blank project.

openFeatureForm

Opens a new 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

Opens the message log dock widget.

openURL

Open a url in the users browser.

pasteFromClipboard

Paste features from clipboard to the layer

pluginHelpMenu

Returns a reference to the main window "Plugin Help" sub-menu.

pluginManagerInterface

rtype

QgsPluginManagerInterface

pluginMenu

Returns a reference to the main window "Plugin" menu.

pluginToolBar

Returns a reference to the main window "Plugin" toolbar.

preloadForm

This method is only needed when using a UI form with a custom widget plugin and calling openFeatureForm or getFeatureForm from Python (PyQt) and you haven't used the info tool first.

projectMenu

Returns a reference to the main window "Project" menu.

rasterMenu

Returns a reference to the main window "Raster" menu.

rasterToolBar

Returns a reference to the main window "Raster" toolbar.

receivers

registerApplicationExitBlocker

Register a new application exit blocker, which can be used to prevent the QGIS application from exiting while a plugin or script has unsaved changes.

registerCustomDropHandler

Register a new custom drop handler.

registerCustomLayoutDropHandler

Register a new custom drop handler for layout windows.

registerCustomProjectOpenHandler

Register a new custom project open handler.

registerDevToolWidgetFactory

Register a new tool in the development/debugging tools dock.

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 map layer properties dialog.

registerMapToolHandler

Register a new application map tool handler, which can be used to automatically setup all connections and logic required to switch to a custom map tool whenever the state of the QGIS application permits.

registerOptionsWidgetFactory

Register a new tab in the options dialog.

registerProjectPropertiesWidgetFactory

Register a new tab in the project properties 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

Removes the specified dock widget from main window (without deleting 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

selectionToolBar

Returns a reference to the main window "Selection" toolbar.

sender

senderSignalIndex

setActiveLayer

Set the active layer (layer gets selected in the legend) returns True if the layer exists, False otherwise

setGpsPanelConnection

Sets a GPS connection to use within the GPS Panel widget.

settingsMenu

Returns a reference to the main window "Settings" menu.

shapeDigitizeToolBar

Returns a reference to the main window "Shape Digitizing" toolbar.

showAttributeTable

Open attribute table dialog

showLayerProperties

Open layer properties dialog

showLayoutManager

Opens the layout manager dialog.

showOptionsDialog

Opens the options dialog.

showProjectPropertiesDialog

Opens the project properties dialog.

statusBarIface

Returns a pointer to the app's status bar interface.

takeAppScreenShots

Take screenshots for user documentation

timerEvent

unregisterApplicationExitBlocker

Unregister a previously registered application exit blocker.

unregisterCustomDropHandler

Unregister a previously registered custom drop handler.

unregisterCustomLayoutDropHandler

Unregister a previously registered custom drop handler for layout windows.

unregisterCustomProjectOpenHandler

Unregister a previously registered custom project open handler.

unregisterDevToolWidgetFactory

Unregister a previously registered tool factory from the development/debugging tools dock.

unregisterMainWindowAction

Unregister a previously registered action.

unregisterMapLayerConfigWidgetFactory

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

unregisterMapToolHandler

Unregister a previously registered map tool handler.

unregisterOptionsWidgetFactory

Unregister a previously registered tab in the options dialog.

unregisterProjectPropertiesWidgetFactory

Unregister a previously registered tab in the options dialog.

vectorLayerTools

Access the vector layer tools instance.

vectorMenu

Returns a reference to the main window "Vector" menu.

vectorToolBar

Returns a reference to the main window "Vector" toolbar.

viewMenu

Returns a reference to the main window "View" menu.

webMenu

Returns a reference to the main window "Web" menu.

webToolBar

Returns a reference to the main window "Web" toolbar.

windowMenu

Returns a reference to the main window "Window" menu.

zoomFull

Zooms to the full extent of all map layers.

zoomToActiveLayer

Zooms to extent of the active layer.

zoomToNext

Zooms to the next view extent.

zoomToPrevious

Zooms to the previous view extent.

Signals

currentLayerChanged

Emitted whenever current (selected) layer changes.

currentThemeChanged

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

initializationCompleted

Emitted when the initialization is complete.

layerSavedAs

Emitted when a layer has been saved using save as.

layoutDesignerClosed

Emitted after a layout designer window is closed.

layoutDesignerOpened

Emitted when a new layout designer has been opened.

layoutDesignerWillBeClosed

Emitted before a layout designer is going to be closed and deleted.

newProjectCreated

Emitted when starting an entirely new project.

projectRead

Emitted when a project file is successfully read.

actionAbout(self) QAction
Return type

QAction

actionAddAfsLayer(self) QAction

Returns the native Add ArcGIS FeatureServer action.

Return type

QAction

actionAddAllToOverview(self) QAction
Return type

QAction

actionAddAmsLayer(self) QAction

Returns the native Add ArcGIS MapServer action.

Return type

QAction

actionAddFeature(self) QAction

Returns the native Add Feature action.

Return type

QAction

actionAddOgrLayer(self) QAction
Return type

QAction

actionAddPart(self) QAction

Returns the native Add Part action.

Return type

QAction

actionAddPgLayer(self) QAction
Return type

QAction

actionAddRasterLayer(self) QAction
Return type

QAction

actionAddRing(self) QAction

Returns the native Add Ring action.

Return type

QAction

actionAddToOverview(self) QAction
Return type

QAction

actionAddVectorTileLayer(self) QAction

Returns the native Add Vector Tile Layer action.

New in version 3.14.

Return type

QAction

actionAddWmsLayer(self) QAction
Return type

QAction

actionAddXyzLayer(self) QAction

Returns the native Add XYZ Layer action.

New in version 3.14.

Return type

QAction

actionAllEdits(self) QAction
Return type

QAction

actionCancelAllEdits(self) QAction
Return type

QAction

actionCancelEdits(self) QAction
Return type

QAction

actionCheckQgisVersion(self) QAction
Return type

QAction

actionCircle2Points(self) QAction

Returns the native add circle from 2 points action. Call trigger() on it to set the map tool.

Return type

QAction

actionCircle2TangentsPoint(self) QAction

Returns the native add circle from 2 tangents and a point action. Call trigger() on it to set the map tool.

Return type

QAction

actionCircle3Points(self) QAction

Returns the native add circle from 3 points action. Call trigger() on it to set the map tool.

Return type

QAction

actionCircle3Tangents(self) QAction

Returns the native add circle from 3 tangents action. Call trigger() on it to set the map tool.

Return type

QAction

actionCircleCenterPoint(self) QAction

Returns the native add circle from center action. Call trigger() on it to set the map tool.

Return type

QAction

actionCopyFeatures(self) QAction

Returns the native Copy Features action.

Return type

QAction

actionCopyLayerStyle(self) QAction
Return type

QAction

actionCreatePrintLayout(self) QAction

Create new print layout action

Return type

QAction

actionCustomProjection(self) QAction
Return type

QAction

actionCutFeatures(self) QAction

Returns the native Cut Features action.

Return type

QAction

actionDeletePart(self) QAction

Returns the native Delete Part action.

Return type

QAction

actionDeleteRing(self) QAction

Returns the native Delete Ring action.

Return type

QAction

actionDeleteSelected(self) QAction

Returns the native Delete Selected Features action.

Return type

QAction

actionDraw(self) QAction

Returns the native draw action.

Return type

QAction

actionDuplicateLayer(self) QAction
Return type

QAction

actionEllipseCenter2Points(self) QAction

Returns the native add ellipse from center and 2 points action. Call trigger() on it to set the map tool.

Return type

QAction

actionEllipseCenterPoint(self) QAction

Returns the native add ellipse from center and a point action. Call trigger() on it to set the map tool.

Return type

QAction

actionEllipseExtent(self) QAction

Returns the native add ellipse from an extent action. Call trigger() on it to set the map tool.

Return type

QAction

actionEllipseFoci(self) QAction

Returns the native add ellipse from foci action. Call trigger() on it to set the map tool.

Return type

QAction

actionExit(self) QAction

Returns the Exit QGIS action.

Return type

QAction

actionFeatureAction(self) QAction

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

Return type

QAction

actionHelpContents(self) QAction
Return type

QAction

actionHideAllLayers(self) QAction
Return type

QAction

actionHideDeselectedLayers(self) QAction

Returns the Hide Deselected Layers action.

New in version 3.0.

Return type

QAction

actionHideSelectedLayers(self) QAction
Return type

QAction

actionIdentify(self) QAction

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

Return type

QAction

actionLayerProperties(self) QAction
Return type

QAction

actionLayerSaveAs(self) QAction
Return type

QAction

actionManagePlugins(self) QAction
Return type

QAction

actionMapTips(self) QAction

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

Return type

QAction

actionMeasure(self) QAction

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

Return type

QAction

actionMeasureArea(self) QAction

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

Return type

QAction

actionMoveFeature(self) QAction

Returns the native Move Features action.

Return type

QAction

actionNewBookmark(self) QAction

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

Return type

QAction

actionNewProject(self) QAction

Returns the native New Project action.

Return type

QAction

actionNewVectorLayer(self) QAction
Return type

QAction

actionOpenFieldCalculator(self) QAction
Return type

QAction

actionOpenProject(self) QAction

Returns the Open Project action.

Return type

QAction

actionOpenStatisticalSummary(self) QAction

Statistical summary action.

New in version 3.0.

Return type

QAction

actionOpenTable(self) QAction
Return type

QAction

actionOptions(self) QAction
Return type

QAction

actionPan(self) QAction

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

Return type

QAction

actionPanToSelected(self) QAction

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

Return type

QAction

actionPasteFeatures(self) QAction

Returns the native Paste Features action.

Return type

QAction

actionPasteLayerStyle(self) QAction
Return type

QAction

actionPluginListSeparator(self) QAction
Return type

QAction

actionProjectProperties(self) QAction

Returns the native Project Properties action.

Return type

QAction

actionQgisHomePage(self) QAction
Return type

QAction

actionRectangle3PointsDistance(self) QAction

Returns the native add rectangle from 3 points (distance from 2nd and 3rd points) action. Call trigger() on it to set the map tool.

Return type

QAction

actionRectangle3PointsProjected(self) QAction

Returns the native add rectangle from 3 points (distance from projected 3rd point on segment p1 and p2) action. Call trigger() on it to set the map tool.

Return type

QAction

actionRectangleCenterPoint(self) QAction

Returns the native add rectangle from center and a point action. Call trigger() on it to set the map tool.

Return type

QAction

actionRectangleExtent(self) QAction

Returns the native add rectangle from extent action. Call trigger() on it to set the map tool.

Return type

QAction

actionRegularPolygon2Points(self) QAction

Returns the native add regular polygon from 2 points action. Call trigger() on it to set the map tool.

Return type

QAction

actionRegularPolygonCenterCorner(self) QAction

Returns the native add regular polygon from center and a corner action. Call trigger() on it to set the map tool.

Return type

QAction

actionRegularPolygonCenterPoint(self) QAction

Returns the native add regular polygon from center and a point action. Call trigger() on it to set the map tool.

Return type

QAction

actionRemoveAllFromOverview(self) QAction
Return type

QAction

actionRollbackAllEdits(self) QAction
Return type

QAction

actionRollbackEdits(self) QAction
Return type

QAction

actionSaveActiveLayerEdits(self) QAction
Return type

QAction

actionSaveAllEdits(self) QAction
Return type

QAction

actionSaveEdits(self) QAction
Return type

QAction

actionSaveMapAsImage(self) QAction

Returns the native Save Map as Image action.

Return type

QAction

actionSaveProject(self) QAction

Returns the native Save Project action.

Return type

QAction

actionSaveProjectAs(self) QAction

Returns the native Save Project As action.

Return type

QAction

actionSelect(self) QAction

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

Return type

QAction

actionSelectFreehand(self) QAction

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

Return type

QAction

actionSelectPolygon(self) QAction

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

Return type

QAction

actionSelectRadius(self) QAction

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

Return type

QAction

actionSelectRectangle(self) QAction

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

Return type

QAction

actionShowAllLayers(self) QAction
Return type

QAction

actionShowBookmarks(self) QAction

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

Return type

QAction

actionShowLayoutManager(self) QAction

Show layout manager action

Return type

QAction

actionShowPythonDialog(self) QAction
Return type

QAction

actionShowSelectedLayers(self) QAction
Return type

QAction

actionSimplifyFeature(self) QAction

Returns the native Simplify/Smooth Features action.

Return type

QAction

actionSplitFeatures(self) QAction

Returns the native Split Features action.

Return type

QAction

actionSplitParts(self) QAction

Returns the native Split Parts action.

Return type

QAction

actionToggleEditing(self) QAction
Return type

QAction

actionToggleFullScreen(self) QAction
Return type

QAction

actionToggleSelectedLayers(self) QAction

Returns the Toggle Selected Layers action.

New in version 3.14.

Return type

QAction

actionToggleSelectedLayersIndependently(self) QAction

Returns the Toggle Selected Layers Independently action.

New in version 3.14.

Return type

QAction

actionVertexTool(self) QAction

Returns the native “Vertex Tool for All Layers” action.

Return type

QAction

actionVertexToolActiveLayer(self) QAction

Returns the native “Vertex Tool for Active Layer” action.

New in version 3.6.

Return type

QAction

actionZoomActualSize(self) QAction

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

Return type

QAction

actionZoomFullExtent(self) QAction

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

Return type

QAction

actionZoomIn(self) QAction

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

Return type

QAction

actionZoomLast(self) QAction

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

Return type

QAction

actionZoomNext(self) QAction

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

Return type

QAction

actionZoomOut(self) QAction

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

Return type

QAction

actionZoomToLayer(self) QAction

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

Return type

QAction

actionZoomToSelected(self) QAction

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

Return type

QAction

activeLayer(self) QgsMapLayer

Returns a pointer to the active layer (layer selected in the legend)

Return type

QgsMapLayer

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.

Parameters
addCustomActionForLayerType(self, action: QAction, menu: str, type: QgsMapLayerType, 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.

Parameters
  • action (QAction) –

  • menu (str) –

  • type (QgsMapLayerType) –

  • allLayers (bool) –

addDatabaseToolBarIcon(self, qAction: QAction) int

Add an icon to the Database toolbar

Parameters

qAction (QAction) –

Return type

int

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 (QWidget) – widget to add. The toolbar will take ownership of this widget

Return type

QAction

Returns

the QAction you can use to remove this widget from the toolbar

addDockWidget(self, area: Qt.DockWidgetArea, dockwidget: QDockWidget)

Adds a dock widget to the main window, in the specified dock area.

Parameters
  • area (Qt.DockWidgetArea) –

  • dockwidget (QDockWidget) –

addLayerMenu(self) QMenu

Returns a reference to the main window “Add Layer” menu.

New in version 2.5.

Return type

QMenu

addMeshLayer(self, url: str, baseName: str, providerKey: str) QgsMeshLayer

Adds a mesh layer to the current project.

Parameters
  • url (str) –

  • baseName (str) –

  • providerKey (str) –

Return type

QgsMeshLayer

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

Add action to the Database menu

Parameters
  • name (str) –

  • action (QAction) –

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

Add action to the plugins menu

Parameters
  • name (str) –

  • action (QAction) –

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

Add action to the Raster menu

Parameters
  • name (str) –

  • action (QAction) –

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

Add action to the Vector menu

Parameters
  • name (str) –

  • action (QAction) –

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

Add action to the Web menu

Parameters
  • name (str) –

  • action (QAction) –

addProject(self, project: str) bool

Adds (opens) a project

Parameters

project (str) –

Return type

bool

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

Adds a raster layer to the current project, given a raster layer file name.

addRasterLayer(self, url: str, layerName: str, providerKey: str) -> QgsRasterLayer Adds a raster layer to the current project, from the specified raster data provider.

Parameters
  • rasterLayerPath (str) –

  • baseName (str = '') –

Return type

QgsRasterLayer

addRasterToolBarIcon(self, qAction: QAction) int

Add an icon to the Raster toolbar

Parameters

qAction (QAction) –

Return type

int

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 (QWidget) – widget to add. The toolbar will take ownership of this widget

Return type

QAction

Returns

the QAction you can use to remove this widget from the toolbar

addTabifiedDockWidget(self, area: Qt.DockWidgetArea, dockwidget: QDockWidget, tabifyWith: Iterable[str] = [], raiseTab: bool = False)

Add a dock widget to the given area and tabify it (if other dock widgets exist in the same area). The new tab will be below other tabs unless raiseTab is passed as True.

tabifyWith is a list of dock widget object names, ordered by priority, with which the new dock widget should be tabified. Only the first matching object name will be picked. If none of the given object names is found in that area (or if tabifyWith is not given at all), the new dock widget will be created anyways, but its location within that area will be unpredictable.

New in version 3.14.

Parameters
  • area (Qt.DockWidgetArea) –

  • dockwidget (QDockWidget) –

  • tabifyWith (Iterable[str] = []) –

  • raiseTab (bool = False) –

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.

Parameters

name (str) –

Return type

QToolBar

addToolBarIcon(self, qAction: QAction) int

Add an icon to the plugins toolbar

Parameters

qAction (QAction) –

Return type

int

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 (QWidget) – widget to add. The toolbar will take ownership of this widget

Return type

QAction

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.

Parameters

widget (QWidget) –

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

Adds a vector layer to the current project.

Parameters
  • vectorLayerPath (str) –

  • baseName (str) –

  • providerKey (str) –

Return type

QgsVectorLayer

addVectorTileLayer(self, url: str, baseName: str) QgsVectorTileLayer

Adds a vector tile layer to the current project.

New in version 3.14.

Parameters
  • url (str) –

  • baseName (str) –

Return type

QgsVectorTileLayer

addVectorToolBarIcon(self, qAction: QAction) int

Add an icon to the Vector toolbar

Parameters

qAction (QAction) –

Return type

int

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 (QWidget) – widget to add. The toolbar will take ownership of this widget

Return type

QAction

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

Parameters

qAction (QAction) –

Return type

int

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 (QWidget) – widget to add. The toolbar will take ownership of this widget

Return type

QAction

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.

Parameters

action (QAction) –

advancedDigitizeToolBar(self) QToolBar

Returns a reference to the main window “Advanced Digitizing” toolbar.

Return type

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.

Return type

bool

Returns

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

New in version 3.0.

Parameters
attributesToolBar(self) QToolBar

Returns a reference to the main window “Attributes” toolbar.

Return type

QToolBar

browserModel(self) QgsBrowserGuiModel

Returns the application browser model. Using this shared model is more efficient than creating a new browser model for every use.

New in version 3.4.

Return type

QgsBrowserGuiModel

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

Generate stylesheet

Parameters

opts (Dict[str) – generated default option values, or a changed copy of them

cadDockWidget(self) QgsAdvancedDigitizingDockWidget

Advanced digitizing dock widget

New in version 2.12.

Return type

QgsAdvancedDigitizingDockWidget

childEvent(self, QChildEvent)
closeMapCanvas(self, name: str)

Closes the additional map canvas with matching name.

New in version 3.0.

Parameters

name (str) –

connectNotify(self, QMetaMethod)
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.

See also

closeMapCanvas()

New in version 3.0.

Parameters

name (str) –

Return type

QgsMapCanvas

currentLayerChanged

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

Parameters

layer (QgsMapLayer) –

currentThemeChanged

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

New in version 3.0: [signal]

Parameters

theme (str) –

customEvent(self, QEvent)
dataSourceManagerToolBar(self) QToolBar

Returns a reference to the main window “Data Source Manager” toolbar.

New in version 3.4.

Return type

QToolBar

databaseMenu(self) QMenu

Returns a reference to the main window “Database” menu.

Return type

QMenu

databaseToolBar(self) QToolBar

Returns a reference to the main window “Database” toolbar.

Return type

QToolBar

defaultStyleSheetFont(self) QFont

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

Return type

QFont

defaultStyleSheetOptions(self) Dict[str, Any]

Returns changeable options built from settings and/or defaults

Return type

Dict[str, Any]

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.

Parameters

filter (QgsLocatorFilter) –

digitizeToolBar(self) QToolBar

Returns a reference to the main window “Digitize” toolbar.

Return type

QToolBar

disconnectNotify(self, QMetaMethod)
editMenu(self) QMenu

Returns a reference to the main window “Edit” menu.

Return type

QMenu

editableLayers(self, modified: bool = False) List[QgsMapLayer]

Returns vector layers in edit mode

Parameters

modified (bool = False) – whether to return only layers that have been modified

Return type

List[QgsMapLayer]

Returns

list of layers in legend order, or empty list

fileToolBar(self) QToolBar

Returns a reference to the main window “File” toolbar.

Return type

QToolBar

firstRightStandardMenu(self) QMenu

Returns a reference to the right most standard menu, which is usually the last menu item before the “Help” menu.

This can be used to insert additional top-level menus into their correct position BEFORE the help menu.

Return type

QMenu

getFeatureForm(self, l: QgsVectorLayer, f: QgsFeature) QgsAttributeDialog

Returns a feature form for a given feature.

Parameters
  • l (QgsVectorLayer) – The layer for which the dialog will be created

  • f (QgsFeature) – The feature for which the dialog will be created

Return type

QgsAttributeDialog

Returns

A feature form

helpMenu(self) QMenu

Returns a reference to the main window “Help” menu.

Return type

QMenu

helpToolBar(self) QToolBar

Returns a reference to the main window “Help” toolbar.

Return type

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.

Parameters

dockedToolbar (bool = False) –

Return type

QSize

initializationCompleted

Emitted when the initialization is complete. [signal]

insertAddLayerAction(self, action: QAction)

Add “add layer” action to layer menu

Parameters

action (QAction) –

invalidateLocatorResults(self)

Invalidate results from the locator filter.

This might be useful if the configuration of the filter changed without going through main application settings.

New in version 3.2.

isSignalConnected(self, QMetaMethod) bool
layerMenu(self) QMenu

Returns a reference to the main window “Layer” menu.

Return type

QMenu

layerSavedAs

Emitted when a layer has been saved using save as.

New in version 2.7: [signal]

Parameters
layerToolBar(self) QToolBar

Returns a reference to the main window “Layer” toolbar.

Return type

QToolBar

layerTreeCanvasBridge(self) QgsLayerTreeMapCanvasBridge

Returns a pointer to the layer tree canvas bridge

New in version 2.12.

Return type

QgsLayerTreeMapCanvasBridge

layerTreeInsertionPoint(self) QgsLayerTreeRegistryBridge.InsertionPoint

Returns the insertion point. This represents the current layer tree group and index where newly added map layers should be inserted into.

New in version 3.10.

Return type

QgsLayerTreeRegistryBridge.InsertionPoint

layerTreeView(self) QgsLayerTreeView
Return type

QgsLayerTreeView

layoutDesignerClosed

Emitted after a layout designer window is closed.

New in version 3.0: [signal]

layoutDesignerOpened

Emitted when a new layout designer has been opened.

New in version 3.0: [signal]

Parameters

designer (QgsLayoutDesignerInterface) –

layoutDesignerWillBeClosed

Emitted before a layout designer is going to be closed and deleted.

New in version 3.0: [signal]

Parameters

designer (QgsLayoutDesignerInterface) –

locatorSearch(self, searchText: str)

This will perform a search in the locator bar by setting the line edit text to searchText and automatically displaying any results.

New in version 3.10.

Parameters

searchText (str) –

mainWindow(self) QWidget

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

Return type

QWidget

mapCanvas(self) QgsMapCanvas

Returns a pointer to the map canvas

Return type

QgsMapCanvas

mapCanvases(self) List[QgsMapCanvas]

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

New in version 3.0.

Return type

List[QgsMapCanvas]

mapNavToolToolBar(self) QToolBar

Returns a reference to the main window “Map Navigation” toolbar.

Return type

QToolBar

mapToolActionGroup(self) QActionGroup

Returns the action group for map tools.

Any actions added by plugins for toggling a map tool should also be added to this action group so that they behave identically to the native, in-built map tool actions.

New in version 3.16.

Return type

QActionGroup

messageBar(self) QgsMessageBar

Returns the message bar of the main app

Return type

QgsMessageBar

messageTimeout(self) int

Returns the timeout for timed messages: default of 5 seconds

Return type

int

newLayerMenu(self) QMenu

Returns a reference to the main window “Create New Layer” menu.

Return type

QMenu

newProject(self, promptToSaveFlag: bool = False) bool

Starts a new blank project.

If promptToSaveFlag is True then users will be prompted to save any currently open project (if that project has changes). If the flag is False, then the current project will be closed without prompting to save (possibly resulting in data loss).

Since QGIS 3.10.1, returns True if a new project was created, or False if the operation was not successful (e.g. the user opted to cancel when prompted to save the current project).

Parameters

promptToSaveFlag (bool = False) –

Return type

bool

newProjectCreated

Emitted when starting an entirely new project.

Note

This is similar to projectRead(); plugins 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

Opens a new feature form. Returns True if dialog was accepted (if shown modal, True otherwise).

Parameters
  • l (QgsVectorLayer) – vector layer

  • f (QgsFeature) – feature to show/modify

  • updateFeatureOnly (bool = False) – only update the feature update (don’t change any attributes of the layer) [UNUSED]

  • showModal (bool = True) – if True, will wait for the dialog to be executed (only shown otherwise)

Return type

bool

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.

Parameters

layout (QgsMasterLayoutInterface) –

Return type

QgsLayoutDesignerInterface

openLayoutDesigners(self) List[QgsLayoutDesignerInterface]

Returns all currently open layout designers.

New in version 3.0.

Return type

List[QgsLayoutDesignerInterface]

openMessageLog(self)

Opens 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 (str) – URL to open

  • useQgisDocDirectory (bool = True) – If True, the URL will be formed by concatenating url to the QGIS documentation directory path (prefix/share/doc)

Deprecated since version Use: QDesktopServices instead

pasteFromClipboard(self, QgsMapLayer)

Paste features from clipboard to the layer

New in version 3.0.

pluginHelpMenu(self) QMenu

Returns a reference to the main window “Plugin Help” sub-menu.

Plugins are encouraged to insert help and about actions in this submenu instead of creating a submenu under the pluginMenu() which solely contains Plugin Help or About actions.

New in version 3.10.

Return type

QMenu

pluginManagerInterface(self) QgsPluginManagerInterface
Return type

QgsPluginManagerInterface

pluginMenu(self) QMenu

Returns a reference to the main window “Plugin” menu.

Return type

QMenu

pluginToolBar(self) QToolBar

Returns a reference to the main window “Plugin” toolbar.

Return type

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 (PyQt) 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 usual.

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

Parameters

uifile (str) –

projectMenu(self) QMenu

Returns a reference to the main window “Project” menu.

Return type

QMenu

projectRead

Emitted when a project file is successfully read.

Note

This is useful for plugins that store properties with project files. A plugin can connect to this signal. When it is emitted the plugin knows to then check the project properties for any relevant state. [signal]

rasterMenu(self) QMenu

Returns a reference to the main window “Raster” menu.

Return type

QMenu

rasterToolBar(self) QToolBar

Returns a reference to the main window “Raster” toolbar.

Return type

QToolBar

receivers(self, PYQT_SIGNAL) int
registerApplicationExitBlocker(self, blocker: QgsApplicationExitBlockerInterface)

Register a new application exit blocker, which can be used to prevent the QGIS application from exiting while a plugin or script has unsaved changes.

Note

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

New in version 3.16.

Parameters

blocker (QgsApplicationExitBlockerInterface) –

registerCustomDropHandler(self, handler: QgsCustomDropHandler)

Register a new custom drop handler.

Note

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

New in version 3.0.

Parameters

handler (QgsCustomDropHandler) –

registerCustomLayoutDropHandler(self, handler: QgsLayoutCustomDropHandler)

Register a new custom drop handler for layout windows.

Note

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

New in version 3.0.

Parameters

handler (QgsLayoutCustomDropHandler) –

registerCustomProjectOpenHandler(self, handler: QgsCustomProjectOpenHandler)

Register a new custom project open handler.

Note

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

New in version 3.14.

Parameters

handler (QgsCustomProjectOpenHandler) –

registerDevToolWidgetFactory(self, factory: QgsDevToolWidgetFactory)

Register a new tool in the development/debugging tools dock.

Note

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

New in version 3.14.

Parameters

factory (QgsDevToolWidgetFactory) –

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.

Parameters

filter (QgsLocatorFilter) –

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

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

Parameters
  • action (QAction) –

  • defaultShortcut (str) –

Return type

bool

registerMapLayerConfigWidgetFactory(self, factory: QgsMapLayerConfigWidgetFactory)

Register a new tab in the map layer properties dialog.

Note

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

New in version 2.16.

Parameters

factory (QgsMapLayerConfigWidgetFactory) –

registerMapToolHandler(self, handler: QgsAbstractMapToolHandler)

Register a new application map tool handler, which can be used to automatically setup all connections and logic required to switch to a custom map tool whenever the state of the QGIS application permits.

Note

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

New in version 3.16.

Parameters

handler (QgsAbstractMapToolHandler) –

registerOptionsWidgetFactory(self, factory: QgsOptionsWidgetFactory)

Register a new tab in the options dialog.

Note

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

New in version 3.0.

Parameters

factory (QgsOptionsWidgetFactory) –

registerProjectPropertiesWidgetFactory(self, factory: QgsOptionsWidgetFactory)

Register a new tab in the project properties dialog.

Note

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

New in version 3.16.

Parameters

factory (QgsOptionsWidgetFactory) –

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

Parameters

action (QAction) –

removeCustomActionForLayerType(self, action: QAction) bool

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

Parameters

action (QAction) –

Return type

bool

removeDatabaseToolBarIcon(self, qAction: QAction)

Remove an action (icon) from the Database toolbar

Parameters

qAction (QAction) –

removeDockWidget(self, dockwidget: QDockWidget)

Removes the specified dock widget from main window (without deleting it).

See also

addDockWidget()

Parameters

dockwidget (QDockWidget) –

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

Remove action from the Database menu

Parameters
  • name (str) –

  • action (QAction) –

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

Remove action from the plugins menu

Parameters
  • name (str) –

  • action (QAction) –

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

Remove action from the Raster menu

Parameters
  • name (str) –

  • action (QAction) –

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

Remove action from the Vector menu

Parameters
  • name (str) –

  • action (QAction) –

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

Remove action from the Web menu

Parameters
  • name (str) –

  • action (QAction) –

removeRasterToolBarIcon(self, qAction: QAction)

Remove an action (icon) from the Raster toolbar

Parameters

qAction (QAction) –

removeToolBarIcon(self, qAction: QAction)

Remove an action (icon) from the plugin toolbar

Parameters

qAction (QAction) –

removeVectorToolBarIcon(self, qAction: QAction)

Remove an action (icon) from the Vector toolbar

Parameters

qAction (QAction) –

removeWebToolBarIcon(self, qAction: QAction)

Remove an action (icon) from the Web toolbar

Parameters

qAction (QAction) –

removeWindow(self, action: QAction)

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

Parameters

action (QAction) –

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

Save changed default option keys/values to user settings

Parameters

opts (Dict[str) –

selectionToolBar(self) QToolBar

Returns a reference to the main window “Selection” toolbar.

New in version 3.14.

Return type

QToolBar

sender(self) QObject
senderSignalIndex(self) int
setActiveLayer(self, QgsMapLayer) bool

Set the active layer (layer gets selected in the legend) returns True if the layer exists, False otherwise

Return type

bool

setGpsPanelConnection(self, connection: QgsGpsConnection)

Sets a GPS connection to use within the GPS Panel widget.

Any existing GPS connection used by the widget will be disconnect and replaced with this connection. The connection is automatically registered within the QgsApplication.gpsConnectionRegistry().

New in version 3.16.

Parameters

connection (QgsGpsConnection) –

settingsMenu(self) QMenu

Returns a reference to the main window “Settings” menu.

Return type

QMenu

shapeDigitizeToolBar(self) QToolBar

Returns a reference to the main window “Shape Digitizing” toolbar.

New in version 3.0.

Return type

QToolBar

showAttributeTable(self, l: QgsVectorLayer, filterExpression: str = '') QDialog

Open attribute table dialog

Parameters
Return type

QDialog

showLayerProperties(self, l: QgsMapLayer)

Open layer properties dialog

Parameters

l (QgsMapLayer) –

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.

Parameters
  • parent (QWidget = None) –

  • currentPage (str = '') –

showProjectPropertiesDialog(self, currentPage: str = '')

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

New in version 3.16.

Parameters

currentPage (str = '') –

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.

Return type

QgsStatusBar

takeAppScreenShots(self, saveDirectory: str, categories: int = 0)

Take screenshots for user documentation

Parameters
  • saveDirectory (str) – path where the screenshots will be saved

  • categories (int = 0) – an int as a flag value of QgsAppScreenShots.Categories

New in version 3.4.

timerEvent(self, QTimerEvent)
unregisterApplicationExitBlocker(self, blocker: QgsApplicationExitBlockerInterface)

Unregister a previously registered application exit blocker.

New in version 3.16.

Parameters

blocker (QgsApplicationExitBlockerInterface) –

unregisterCustomDropHandler(self, handler: QgsCustomDropHandler)

Unregister a previously registered custom drop handler.

New in version 3.0.

Parameters

handler (QgsCustomDropHandler) –

unregisterCustomLayoutDropHandler(self, handler: QgsLayoutCustomDropHandler)

Unregister a previously registered custom drop handler for layout windows.

New in version 3.0.

Parameters

handler (QgsLayoutCustomDropHandler) –

unregisterCustomProjectOpenHandler(self, handler: QgsCustomProjectOpenHandler)

Unregister a previously registered custom project open handler.

New in version 3.14.

Parameters

handler (QgsCustomProjectOpenHandler) –

unregisterDevToolWidgetFactory(self, factory: QgsDevToolWidgetFactory)

Unregister a previously registered tool factory from the development/debugging tools dock.

New in version 3.14.

Parameters

factory (QgsDevToolWidgetFactory) –

unregisterMainWindowAction(self, action: QAction) bool

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

Parameters

action (QAction) –

Return type

bool

unregisterMapLayerConfigWidgetFactory(self, factory: QgsMapLayerConfigWidgetFactory)

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

New in version 2.16.

Parameters

factory (QgsMapLayerConfigWidgetFactory) –

unregisterMapToolHandler(self, handler: QgsAbstractMapToolHandler)

Unregister a previously registered map tool handler.

New in version 3.16.

Parameters

handler (QgsAbstractMapToolHandler) –

unregisterOptionsWidgetFactory(self, factory: QgsOptionsWidgetFactory)

Unregister a previously registered tab in the options dialog.

New in version 3.0.

Parameters

factory (QgsOptionsWidgetFactory) –

unregisterProjectPropertiesWidgetFactory(self, factory: QgsOptionsWidgetFactory)

Unregister a previously registered tab in the options dialog.

New in version 3.16.

Parameters

factory (QgsOptionsWidgetFactory) –

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.

Return type

QgsVectorLayerTools

Returns

An instance of the vector layer tools

vectorMenu(self) QMenu

Returns a reference to the main window “Vector” menu.

Return type

QMenu

vectorToolBar(self) QToolBar

Returns a reference to the main window “Vector” toolbar.

Return type

QToolBar

viewMenu(self) QMenu

Returns a reference to the main window “View” menu.

Return type

QMenu

webMenu(self) QMenu

Returns a reference to the main window “Web” menu.

Return type

QMenu

webToolBar(self) QToolBar

Returns a reference to the main window “Web” toolbar.

Return type

QToolBar

windowMenu(self) QMenu

Returns a reference to the main window “Window” menu.

Return type

QMenu

zoomFull(self)

Zooms to the full extent of all map layers.

zoomToActiveLayer(self)

Zooms to extent of the active layer.

zoomToNext(self)

Zooms to the next view extent.

zoomToPrevious(self)

Zooms to the previous view extent.