Class: 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.

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: actionAbout(), actionAddAfsLayer(), actionAddAllToOverview(), actionAddAmsLayer(), actionAddFeature(), actionAddOgrLayer(), actionAddPart(), actionAddPgLayer(), actionAddPointCloudLayer(), actionAddRasterLayer(), actionAddRing(), actionAddToOverview(), actionAddVectorTileLayer(), actionAddWmsLayer(), actionAddXyzLayer(), actionAllEdits(), actionCancelAllEdits(), actionCancelEdits(), actionCheckQgisVersion(), actionCopyFeatures(), actionCopyLayerStyle(), actionCreatePrintLayout(), actionCustomProjection(), actionCutFeatures(), actionDeletePart(), actionDeleteRing(), actionDeleteSelected(), actionDraw(), actionDuplicateLayer(), actionExit(), actionFeatureAction(), actionHelpContents(), actionHideAllLayers(), actionHideDeselectedLayers(), actionHideSelectedLayers(), actionIdentify(), actionLayerProperties(), actionLayerSaveAs(), actionManagePlugins(), actionMapTips(), actionMeasure(), actionMeasureArea(), actionMoveFeature(), actionNewBookmark(), actionNewProject(), actionNewVectorLayer(), actionOpenFieldCalculator(), actionOpenProject(), actionOpenStatisticalSummary(), actionOpenTable(), actionOptions(), actionPan(), actionPanToSelected(), actionPasteFeatures(), actionPasteLayerStyle(), actionPluginListSeparator(), actionProjectProperties(), actionQgisHomePage(), actionRemoveAllFromOverview(), actionRollbackAllEdits(), actionRollbackEdits(), actionSaveActiveLayerEdits(), actionSaveAllEdits(), actionSaveEdits(), actionSaveMapAsImage(), actionSaveProject(), actionSaveProjectAs(), actionSelect(), actionSelectFreehand(), actionSelectPolygon(), actionSelectRadius(), actionSelectRectangle(), actionShowAllLayers(), actionShowBookmarks(), actionShowLayoutManager(), actionShowPythonDialog(), actionShowSelectedLayers(), actionSimplifyFeature(), actionSplitFeatures(), actionSplitParts(), actionToggleEditing(), actionToggleFullScreen(), actionToggleSelectedLayers(), actionToggleSelectedLayersIndependently(), actionVertexTool(), actionVertexToolActiveLayer(), actionZoomActualSize(), actionZoomFullExtent(), actionZoomIn(), actionZoomLast(), actionZoomNext(), actionZoomOut(), actionZoomToLayer(), actionZoomToLayers(), actionZoomToSelected(), activeDecorations(), activeLayer(), addCustomActionForLayer(), addCustomActionForLayerType(), addDatabaseToolBarIcon(), addDatabaseToolBarWidget(), addDockWidget(), addLayerMenu(), addMeshLayer(), addPluginToDatabaseMenu(), addPluginToMenu(), addPluginToMeshMenu(), addPluginToRasterMenu(), addPluginToVectorMenu(), addPluginToWebMenu(), addPointCloudLayer(), addProject(), addProjectExportAction(), addProjectImportAction(), addRasterLayer(), addRasterToolBarIcon(), addRasterToolBarWidget(), addTabifiedDockWidget(), addTiledSceneLayer(), addToolBar(), addToolBarIcon(), addToolBarWidget(), addUserInputWidget(), addVectorLayer(), addVectorTileLayer(), addVectorToolBarIcon(), addVectorToolBarWidget(), addWebToolBarIcon(), addWebToolBarWidget(), addWindow(), advancedDigitizeToolBar(), askForDatumTransform(), attributesToolBar(), blockActiveLayerChanges(), browserModel(), buildStyleSheet(), cadDockWidget(), closeMapCanvas(), closeMapCanvas3D(), copySelectionToClipboard(), createNewMapCanvas(), createNewMapCanvas3D(), createProjectModelSubMenu(), dataSourceManagerToolBar(), databaseMenu(), databaseToolBar(), defaultStyleSheetFont(), defaultStyleSheetOptions(), deregisterLocatorFilter(), digitizeToolBar(), editMenu(), editableLayers(), fileToolBar(), firstRightStandardMenu(), getFeatureForm(), gpsTools(), helpMenu(), helpToolBar(), iconSize(), insertAddLayerAction(), invalidateLocatorResults(), layerMenu(), layerToolBar(), layerTreeCanvasBridge(), layerTreeInsertionPoint(), layerTreeView(), locatorSearch(), mainWindow(), mapCanvas(), mapCanvases(), mapCanvases3D(), mapNavToolToolBar(), mapToolActionGroup(), meshMenu(), messageBar(), messageTimeout(), newLayerMenu(), newProject(), openDataSourceManagerPage(), openFeatureForm(), openLayoutDesigner(), openLayoutDesigners(), openMessageLog(), openURL(), pasteFromClipboard(), pluginHelpMenu(), pluginManagerInterface(), pluginMenu(), pluginToolBar(), preloadForm(), projectImportExportMenu(), projectMenu(), projectModelsMenu(), rasterMenu(), rasterToolBar(), registerApplicationExitBlocker(), registerCustomDropHandler(), registerCustomLayoutDropHandler(), registerCustomProjectOpenHandler(), registerDevToolWidgetFactory(), registerLocatorFilter(), registerMainWindowAction(), registerMapLayerConfigWidgetFactory(), registerMapToolHandler(), registerOptionsWidgetFactory(), registerProjectPropertiesWidgetFactory(), reloadConnections(), removeAddLayerAction(), removeCustomActionForLayerType(), removeDatabaseToolBarIcon(), removeDockWidget(), removePluginDatabaseMenu(), removePluginMenu(), removePluginMeshMenu(), removePluginRasterMenu(), removePluginVectorMenu(), removePluginWebMenu(), removeProjectExportAction(), removeProjectImportAction(), removeRasterToolBarIcon(), removeToolBarIcon(), removeVectorToolBarIcon(), removeWebToolBarIcon(), removeWindow(), saveStyleSheetOptions(), selectionToolBar(), setActiveLayer(), setGpsPanelConnection(), settingsMenu(), shapeDigitizeToolBar(), showApiDocumentation(), showAttributeTable(), showLayerProperties(), showLayoutManager(), showOptionsDialog(), showProjectPropertiesDialog(), statusBarIface(), unregisterApplicationExitBlocker(), unregisterCustomDropHandler(), unregisterCustomLayoutDropHandler(), unregisterCustomProjectOpenHandler(), unregisterDevToolWidgetFactory(), unregisterMainWindowAction(), unregisterMapLayerConfigWidgetFactory(), unregisterMapToolHandler(), unregisterOptionsWidgetFactory(), unregisterProjectPropertiesWidgetFactory(), userProfileManager(), vectorLayerTools(), vectorMenu(), vectorToolBar(), viewMenu(), webMenu(), webToolBar(), windowMenu(), zoomFull(), zoomToActiveLayer(), zoomToNext(), zoomToPrevious()

Class Hierarchy

Inheritance diagram of qgis.gui.QgisInterface

Base classes

QObject

Abstract Methods

actionAbout

actionAddAfsLayer

Returns the native Add ArcGIS REST Server action.

actionAddAllToOverview

actionAddAmsLayer

Returns the native Add ArcGIS REST Server action.

actionAddFeature

Returns the native Add Feature action.

actionAddOgrLayer

actionAddPart

Returns the native Add Part action.

actionAddPgLayer

actionAddPointCloudLayer

Returns the native Add Point Cloud Layer action.

actionAddRasterLayer

actionAddRing

Returns the native Add Ring action.

actionAddToOverview

actionAddVectorTileLayer

Returns the native Add Vector Tile Layer action.

actionAddWmsLayer

actionAddXyzLayer

Returns the native Add XYZ Layer action.

actionAllEdits

actionCancelAllEdits

actionCancelEdits

actionCheckQgisVersion

actionCopyFeatures

Returns the native Copy Features action.

actionCopyLayerStyle

actionCreatePrintLayout

Create new print layout action

actionCustomProjection

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

actionExit

Returns the Exit QGIS action.

actionFeatureAction

Returns the native run action feature action.

actionHelpContents

actionHideAllLayers

actionHideDeselectedLayers

Returns the Hide Deselected Layers action.

actionHideSelectedLayers

actionIdentify

Returns the native identify action.

actionLayerProperties

actionLayerSaveAs

actionManagePlugins

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

actionOpenFieldCalculator

actionOpenProject

Returns the Open Project action.

actionOpenStatisticalSummary

Statistical summary action.

actionOpenTable

actionOptions

actionPan

Returns the native pan action.

actionPanToSelected

Returns the native pan to selected action.

actionPasteFeatures

Returns the native Paste Features action.

actionPasteLayerStyle

actionPluginListSeparator

actionProjectProperties

Returns the native Project Properties action.

actionQgisHomePage

actionRemoveAllFromOverview

actionRollbackAllEdits

actionRollbackEdits

actionSaveActiveLayerEdits

actionSaveAllEdits

actionSaveEdits

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

actionShowBookmarks

Returns the native show bookmarks action.

actionShowLayoutManager

Show layout manager action

actionShowPythonDialog

actionShowSelectedLayers

actionSimplifyFeature

Returns the native Simplify/Smooth Features action.

actionSplitFeatures

Returns the native Split Features action.

actionSplitParts

Returns the native Split Parts action.

actionToggleEditing

actionToggleFullScreen

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.

actionZoomToLayers

Returns the native zoom to layers action.

actionZoomToSelected

Returns the native zoom to selected action.

activeDecorations

Returns a list of the active decorations.

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, using the specified data provider and source url.

addPluginToDatabaseMenu

Add action to the Database menu

addPluginToMenu

Add action to the plugins menu

addPluginToMeshMenu

Add action to the Mesh menu

addPluginToRasterMenu

Add action to the Raster menu

addPluginToVectorMenu

Add action to the Vector menu

addPluginToWebMenu

Add action to the Web menu

addPointCloudLayer

Adds a point cloud layer to the current project, using the specified data provider and source url.

addProject

Adds (opens) a project

addProjectExportAction

Adds an action to the QGIS "Export project" menu.

addProjectImportAction

Adds an action to the QGIS "Import project" menu.

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).

addTiledSceneLayer

Adds a tiled scene layer to the current project, using the specified data provider and source url.

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, using the specified data provider and source url.

addVectorTileLayer

Adds a vector tile layer to the current project, using the specified source url.

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.

blockActiveLayerChanges

Sets whether changes to the active layer should be temporarily blocked.

browserModel

Returns the application browser model.

buildStyleSheet

Generate stylesheet

cadDockWidget

Advanced digitizing dock widget

closeMapCanvas

Closes the additional map canvas with matching name.

closeMapCanvas3D

Closes the additional map canvas with matching name.

copySelectionToClipboard

Copy selected features from the layer to clipboard

createNewMapCanvas

Create a new map canvas with the specified unique name.

createNewMapCanvas3D

Create a new 3D map canvas with the specified unique name.

createProjectModelSubMenu

Creates a new project model submenu in the "Projects" - "Models" submenu.

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.

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.

gpsTools

Returns an interface to allow plugins to use QGIS GPS tools.

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.

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

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.

mapCanvases3D

Returns a list of all 3D 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.

meshMenu

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

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.

openDataSourceManagerPage

Opens a page in the main window "Data Source Manager" dialog.

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, and optionally activates a specific tab by name.

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

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.

projectImportExportMenu

Returns a reference to the main window "Import/Export" project menu.

projectMenu

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

projectModelsMenu

Returns a reference to the main window "Projects" - "Models" submenu.

rasterMenu

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

rasterToolBar

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

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

removePluginMeshMenu

Remove action from the Mesh menu

removePluginRasterMenu

Remove action from the Raster menu

removePluginVectorMenu

Remove action from the Vector menu

removePluginWebMenu

Remove action from the Web menu

removeProjectExportAction

Adds an action to the QGIS "Export project" menu.

removeProjectImportAction

Adds an action to the QGIS "Import project" 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.

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.

showApiDocumentation

Show a page of the API documentation

showAttributeTable

Open attribute table dialog

showLayerProperties

Opens layer properties dialog for the layer l.

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.

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.

userProfileManager

Returns a reference to the user profile manager

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.

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgisInterface. See the FAQ for more details.

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.

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.

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.

takeAppScreenShots

Take screenshots for user documentation

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.

class qgis.gui.QgisInterface[source]

Bases: QObject

abstract actionAbout(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionAddAfsLayer(self) QAction | None[source]

Returns the native Add ArcGIS REST Server action.

Return type:

Optional[QAction]

abstract actionAddAllToOverview(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionAddAmsLayer(self) QAction | None[source]

Returns the native Add ArcGIS REST Server action.

Return type:

Optional[QAction]

abstract actionAddFeature(self) QAction | None[source]

Returns the native Add Feature action.

Return type:

Optional[QAction]

abstract actionAddOgrLayer(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionAddPart(self) QAction | None[source]

Returns the native Add Part action.

Return type:

Optional[QAction]

abstract actionAddPgLayer(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionAddPointCloudLayer(self) QAction | None[source]

Returns the native Add Point Cloud Layer action.

Added in version 3.18.

Return type:

Optional[QAction]

abstract actionAddRasterLayer(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionAddRing(self) QAction | None[source]

Returns the native Add Ring action.

Return type:

Optional[QAction]

abstract actionAddToOverview(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionAddVectorTileLayer(self) QAction | None[source]

Returns the native Add Vector Tile Layer action.

Added in version 3.14.

Return type:

Optional[QAction]

abstract actionAddWmsLayer(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionAddXyzLayer(self) QAction | None[source]

Returns the native Add XYZ Layer action.

Added in version 3.14.

Return type:

Optional[QAction]

abstract actionAllEdits(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionCancelAllEdits(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionCancelEdits(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionCheckQgisVersion(self) QAction | None[source]
Return type:

Optional[QAction]

virtual actionCircle2Points(self) QAction | None[source]

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

Deprecated since version 3.26: Shape digitizing is now part of the add feature tool. To enable the shape tool, use QgsMapToolCapture.setCurrentCaptureTechnique() and then QgsMapToolCapture.setCurrentShapeMapTool().

Return type:

Optional[QAction]

virtual actionCircle2TangentsPoint(self) QAction | None[source]

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

Deprecated since version 3.26: Shape digitizing is now part of the add feature tool. To enable the shape tool, use QgsMapToolCapture.setCurrentCaptureTechnique() and then QgsMapToolCapture.setCurrentShapeMapTool().

Return type:

Optional[QAction]

virtual actionCircle3Points(self) QAction | None[source]

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

Deprecated since version 3.26: Shape digitizing is now part of the add feature tool. To enable the shape tool, use QgsMapToolCapture.setCurrentCaptureTechnique() and then QgsMapToolCapture.setCurrentShapeMapTool().

Return type:

Optional[QAction]

virtual actionCircle3Tangents(self) QAction | None[source]

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

Deprecated since version 3.26: Shape digitizing is now part of the add feature tool. To enable the shape tool, use QgsMapToolCapture.setCurrentCaptureTechnique() and then QgsMapToolCapture.setCurrentShapeMapTool().

Return type:

Optional[QAction]

virtual actionCircleCenterPoint(self) QAction | None[source]

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

Deprecated since version 3.26: Shape digitizing is now part of the add feature tool. To enable the shape tool, use QgsMapToolCapture.setCurrentCaptureTechnique() and then QgsMapToolCapture.setCurrentShapeMapTool().

Return type:

Optional[QAction]

abstract actionCopyFeatures(self) QAction | None[source]

Returns the native Copy Features action.

Return type:

Optional[QAction]

abstract actionCopyLayerStyle(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionCreatePrintLayout(self) QAction | None[source]

Create new print layout action

Return type:

Optional[QAction]

abstract actionCustomProjection(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionCutFeatures(self) QAction | None[source]

Returns the native Cut Features action.

Return type:

Optional[QAction]

abstract actionDeletePart(self) QAction | None[source]

Returns the native Delete Part action.

Return type:

Optional[QAction]

abstract actionDeleteRing(self) QAction | None[source]

Returns the native Delete Ring action.

Return type:

Optional[QAction]

abstract actionDeleteSelected(self) QAction | None[source]

Returns the native Delete Selected Features action.

Return type:

Optional[QAction]

abstract actionDraw(self) QAction | None[source]

Returns the native draw action.

Return type:

Optional[QAction]

abstract actionDuplicateLayer(self) QAction | None[source]
Return type:

Optional[QAction]

virtual actionEllipseCenter2Points(self) QAction | None[source]

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

Deprecated since version 3.26: Shape digitizing is now part of the add feature tool. To enable the shape tool, use QgsMapToolCapture.setCurrentCaptureTechnique() and then QgsMapToolCapture.setCurrentShapeMapTool().

Return type:

Optional[QAction]

virtual actionEllipseCenterPoint(self) QAction | None[source]

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

Deprecated since version 3.26: Shape digitizing is now part of the add feature tool. To enable the shape tool, use QgsMapToolCapture.setCurrentCaptureTechnique() and then QgsMapToolCapture.setCurrentShapeMapTool().

Return type:

Optional[QAction]

virtual actionEllipseExtent(self) QAction | None[source]

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

Deprecated since version 3.26: Shape digitizing is now part of the add feature tool. To enable the shape tool, use QgsMapToolCapture.setCurrentCaptureTechnique() and then QgsMapToolCapture.setCurrentShapeMapTool().

Return type:

Optional[QAction]

virtual actionEllipseFoci(self) QAction | None[source]

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

Deprecated since version 3.26: Shape digitizing is now part of the add feature tool. To enable the shape tool, use QgsMapToolCapture.setCurrentCaptureTechnique() and then QgsMapToolCapture.setCurrentShapeMapTool().

Return type:

Optional[QAction]

abstract actionExit(self) QAction | None[source]

Returns the Exit QGIS action.

Return type:

Optional[QAction]

abstract actionFeatureAction(self) QAction | None[source]

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

Return type:

Optional[QAction]

abstract actionHelpContents(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionHideAllLayers(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionHideDeselectedLayers(self) QAction | None[source]

Returns the Hide Deselected Layers action.

Return type:

Optional[QAction]

abstract actionHideSelectedLayers(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionIdentify(self) QAction | None[source]

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

Return type:

Optional[QAction]

abstract actionLayerProperties(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionLayerSaveAs(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionManagePlugins(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionMapTips(self) QAction | None[source]

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

Return type:

Optional[QAction]

abstract actionMeasure(self) QAction | None[source]

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

Return type:

Optional[QAction]

abstract actionMeasureArea(self) QAction | None[source]

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

Return type:

Optional[QAction]

abstract actionMoveFeature(self) QAction | None[source]

Returns the native Move Features action.

Return type:

Optional[QAction]

abstract actionNewBookmark(self) QAction | None[source]

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

Return type:

Optional[QAction]

abstract actionNewProject(self) QAction | None[source]

Returns the native New Project action.

Return type:

Optional[QAction]

abstract actionNewVectorLayer(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionOpenFieldCalculator(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionOpenProject(self) QAction | None[source]

Returns the Open Project action.

Return type:

Optional[QAction]

abstract actionOpenStatisticalSummary(self) QAction | None[source]

Statistical summary action.

Return type:

Optional[QAction]

abstract actionOpenTable(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionOptions(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionPan(self) QAction | None[source]

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

Return type:

Optional[QAction]

abstract actionPanToSelected(self) QAction | None[source]

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

Return type:

Optional[QAction]

abstract actionPasteFeatures(self) QAction | None[source]

Returns the native Paste Features action.

Return type:

Optional[QAction]

abstract actionPasteLayerStyle(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionPluginListSeparator(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionProjectProperties(self) QAction | None[source]

Returns the native Project Properties action.

Return type:

Optional[QAction]

abstract actionQgisHomePage(self) QAction | None[source]
Return type:

Optional[QAction]

virtual actionRectangle3PointsDistance(self) QAction | None[source]

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

Deprecated since version 3.26: Shape digitizing is now part of the add feature tool. To enable the shape tool, use QgsMapToolCapture.setCurrentCaptureTechnique() and then QgsMapToolCapture.setCurrentShapeMapTool().

Return type:

Optional[QAction]

virtual actionRectangle3PointsProjected(self) QAction | None[source]

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.

Deprecated since version 3.26: Shape digitizing is now part of the add feature tool. To enable the shape tool, use QgsMapToolCapture.setCurrentCaptureTechnique() and then QgsMapToolCapture.setCurrentShapeMapTool().

Return type:

Optional[QAction]

virtual actionRectangleCenterPoint(self) QAction | None[source]

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

Deprecated since version 3.26: Shape digitizing is now part of the add feature tool. To enable the shape tool, use QgsMapToolCapture.setCurrentCaptureTechnique() and then QgsMapToolCapture.setCurrentShapeMapTool().

Return type:

Optional[QAction]

virtual actionRectangleExtent(self) QAction | None[source]

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

Deprecated since version 3.26: Shape digitizing is now part of the add feature tool. To enable the shape tool, use QgsMapToolCapture.setCurrentCaptureTechnique() and then QgsMapToolCapture.setCurrentShapeMapTool().

Return type:

Optional[QAction]

virtual actionRegularPolygon2Points(self) QAction | None[source]

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

Deprecated since version 3.26: Shape digitizing is now part of the add feature tool. To enable the shape tool, use QgsMapToolCapture.setCurrentCaptureTechnique() and then QgsMapToolCapture.setCurrentShapeMapTool().

Return type:

Optional[QAction]

virtual actionRegularPolygonCenterCorner(self) QAction | None[source]

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

Deprecated since version 3.26: Shape digitizing is now part of the add feature tool. To enable the shape tool, use QgsMapToolCapture.setCurrentCaptureTechnique() and then QgsMapToolCapture.setCurrentShapeMapTool().

Return type:

Optional[QAction]

virtual actionRegularPolygonCenterPoint(self) QAction | None[source]

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

Deprecated since version 3.26: Shape digitizing is now part of the add feature tool. To enable the shape tool, use QgsMapToolCapture.setCurrentCaptureTechnique() and then QgsMapToolCapture.setCurrentShapeMapTool().

Return type:

Optional[QAction]

abstract actionRemoveAllFromOverview(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionRollbackAllEdits(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionRollbackEdits(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionSaveActiveLayerEdits(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionSaveAllEdits(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionSaveEdits(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionSaveMapAsImage(self) QAction | None[source]

Returns the native Save Map as Image action.

Return type:

Optional[QAction]

abstract actionSaveProject(self) QAction | None[source]

Returns the native Save Project action.

Return type:

Optional[QAction]

abstract actionSaveProjectAs(self) QAction | None[source]

Returns the native Save Project As action.

Return type:

Optional[QAction]

abstract actionSelect(self) QAction | None[source]

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

Return type:

Optional[QAction]

abstract actionSelectFreehand(self) QAction | None[source]

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

Return type:

Optional[QAction]

abstract actionSelectPolygon(self) QAction | None[source]

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

Return type:

Optional[QAction]

abstract actionSelectRadius(self) QAction | None[source]

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

Return type:

Optional[QAction]

abstract actionSelectRectangle(self) QAction | None[source]

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

Return type:

Optional[QAction]

abstract actionShowAllLayers(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionShowBookmarks(self) QAction | None[source]

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

Return type:

Optional[QAction]

abstract actionShowLayoutManager(self) QAction | None[source]

Show layout manager action

Return type:

Optional[QAction]

abstract actionShowPythonDialog(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionShowSelectedLayers(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionSimplifyFeature(self) QAction | None[source]

Returns the native Simplify/Smooth Features action.

Return type:

Optional[QAction]

abstract actionSplitFeatures(self) QAction | None[source]

Returns the native Split Features action.

Return type:

Optional[QAction]

abstract actionSplitParts(self) QAction | None[source]

Returns the native Split Parts action.

Return type:

Optional[QAction]

abstract actionToggleEditing(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionToggleFullScreen(self) QAction | None[source]
Return type:

Optional[QAction]

abstract actionToggleSelectedLayers(self) QAction | None[source]

Returns the Toggle Selected Layers action.

Added in version 3.14.

Return type:

Optional[QAction]

abstract actionToggleSelectedLayersIndependently(self) QAction | None[source]

Returns the Toggle Selected Layers Independently action.

Added in version 3.14.

Return type:

Optional[QAction]

abstract actionVertexTool(self) QAction | None[source]

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

Return type:

Optional[QAction]

abstract actionVertexToolActiveLayer(self) QAction | None[source]

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

Added in version 3.6.

Return type:

Optional[QAction]

abstract actionZoomActualSize(self) QAction | None[source]

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

Return type:

Optional[QAction]

abstract actionZoomFullExtent(self) QAction | None[source]

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

Return type:

Optional[QAction]

abstract actionZoomIn(self) QAction | None[source]

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

Return type:

Optional[QAction]

abstract actionZoomLast(self) QAction | None[source]

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

Return type:

Optional[QAction]

abstract actionZoomNext(self) QAction | None[source]

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

Return type:

Optional[QAction]

abstract actionZoomOut(self) QAction | None[source]

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

Return type:

Optional[QAction]

abstract actionZoomToLayer(self) QAction | None[source]

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

Deprecated since version 3.40: Use actionZoomToLayers() instead.

Return type:

Optional[QAction]

abstract actionZoomToLayers(self) QAction | None[source]

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

Added in version 3.18.

Return type:

Optional[QAction]

abstract actionZoomToSelected(self) QAction | None[source]

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

Return type:

Optional[QAction]

abstract activeDecorations(self) List[QgsMapDecoration]

Returns a list of the active decorations.

Added in version 3.22.

Return type:

List[QgsMapDecoration]

abstract activeLayer(self) QgsMapLayer | None[source]

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

Return type:

Optional[QgsMapLayer]

abstract addCustomActionForLayer(self, action: QAction | None, layer: QgsMapLayer | None)[source]

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:
  • action (Optional[QAction])

  • layer (Optional[QgsMapLayer])

abstract addCustomActionForLayerType(self, action: QAction | None, menu: str | None, type: Qgis.LayerType, allLayers: bool)[source]

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 (Optional[QAction])

  • menu (Optional[str])

  • type (Qgis.LayerType)

  • allLayers (bool)

abstract addDatabaseToolBarIcon(self, qAction: QAction | None) int[source]

Add an icon to the Database toolbar

Parameters:

qAction (Optional[QAction])

Return type:

int

abstract addDatabaseToolBarWidget(self, widget: QWidget | None) QAction | None[source]

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

Parameters:

widget (Optional[QWidget]) – widget to add. The toolbar will take ownership of this widget

Return type:

Optional[QAction]

Returns:

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

abstract addDockWidget(self, area: Qt.DockWidgetArea, dockwidget: QDockWidget | None)[source]

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

Parameters:
  • area (Qt.DockWidgetArea)

  • dockwidget (Optional[QDockWidget])

abstract addLayerMenu(self) QMenu | None[source]

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

Return type:

Optional[QMenu]

abstract addMeshLayer(self, url: str | None, baseName: str | None, providerKey: str | None) QgsMeshLayer | None[source]

Adds a mesh layer to the current project, using the specified data provider and source url.

The baseName parameter will be used as the layer name (and shown in the map legend).

Parameters:
  • url (Optional[str])

  • baseName (Optional[str])

  • providerKey (Optional[str])

Return type:

Optional[QgsMeshLayer]

abstract addPluginToDatabaseMenu(self, name: str | None, action: QAction | None)[source]

Add action to the Database menu

Parameters:
  • name (Optional[str])

  • action (Optional[QAction])

abstract addPluginToMenu(self, name: str | None, action: QAction | None)[source]

Add action to the plugins menu

Parameters:
  • name (Optional[str])

  • action (Optional[QAction])

abstract addPluginToMeshMenu(self, name: str | None, action: QAction | None)[source]

Add action to the Mesh menu

Added in version 3.24.

Parameters:
  • name (Optional[str])

  • action (Optional[QAction])

abstract addPluginToRasterMenu(self, name: str | None, action: QAction | None)[source]

Add action to the Raster menu

Parameters:
  • name (Optional[str])

  • action (Optional[QAction])

abstract addPluginToVectorMenu(self, name: str | None, action: QAction | None)[source]

Add action to the Vector menu

Parameters:
  • name (Optional[str])

  • action (Optional[QAction])

abstract addPluginToWebMenu(self, name: str | None, action: QAction | None)[source]

Add action to the Web menu

Parameters:
  • name (Optional[str])

  • action (Optional[QAction])

abstract addPointCloudLayer(self, url: str | None, baseName: str | None, providerKey: str | None) QgsPointCloudLayer | None[source]

Adds a point cloud layer to the current project, using the specified data provider and source url.

The baseName parameter will be used as the layer name (and shown in the map legend).

Added in version 3.18.

Parameters:
  • url (Optional[str])

  • baseName (Optional[str])

  • providerKey (Optional[str])

Return type:

Optional[QgsPointCloudLayer]

abstract addProject(self, project: str | None) bool[source]

Adds (opens) a project

Parameters:

project (Optional[str])

Return type:

bool

abstract addProjectExportAction(self, action: QAction | None)[source]

Adds an action to the QGIS “Export project” menu.

Added in version 3.30.

Parameters:

action (Optional[QAction])

abstract addProjectImportAction(self, action: QAction | None)[source]

Adds an action to the QGIS “Import project” menu.

Added in version 3.30.

Parameters:

action (Optional[QAction])

abstract addRasterLayer(self, rasterLayerPath: str | None, baseName: str | None = '') QgsRasterLayer | None[source]

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

The baseName parameter will be used as the layer name (and shown in the map legend).

Parameters:
  • rasterLayerPath (Optional[str])

  • baseName (Optional[str] = '')

Return type:

Optional[QgsRasterLayer]

abstract addRasterLayer(self, url: str | None, layerName: str | None, providerKey: str | None) QgsRasterLayer | None[source]

Adds a raster layer to the current project, from the specified raster data provider and source url.

The layerName parameter will be used as the layer name (and shown in the map legend).

Parameters:
  • url (Optional[str])

  • layerName (Optional[str])

  • providerKey (Optional[str])

Return type:

Optional[QgsRasterLayer]

abstract addRasterToolBarIcon(self, qAction: QAction | None) int[source]

Add an icon to the Raster toolbar

Parameters:

qAction (Optional[QAction])

Return type:

int

abstract addRasterToolBarWidget(self, widget: QWidget | None) QAction | None[source]

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

Parameters:

widget (Optional[QWidget]) – widget to add. The toolbar will take ownership of this widget

Return type:

Optional[QAction]

Returns:

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

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

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.

Added in version 3.14.

Parameters:
  • area (Qt.DockWidgetArea)

  • dockwidget (Optional[QDockWidget])

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

  • raiseTab (bool = False)

abstract addTiledSceneLayer(self, url: str | None, baseName: str | None, providerKey: str | None) QgsTiledSceneLayer | None[source]

Adds a tiled scene layer to the current project, using the specified data provider and source url.

The baseName parameter will be used as the layer name (and shown in the map legend).

Added in version 3.34.

Parameters:
  • url (Optional[str])

  • baseName (Optional[str])

  • providerKey (Optional[str])

Return type:

Optional[QgsTiledSceneLayer]

abstract addToolBar(self, name: str | None) QToolBar | None[source]

Add toolbar with specified name

Parameters:

name (Optional[str])

Return type:

Optional[QToolBar]

abstract addToolBar(self, toolbar: QToolBar | None, area: Qt.ToolBarArea = Qt.TopToolBarArea)[source]

Add a toolbar

Parameters:
  • toolbar (Optional[QToolBar])

  • area (Qt.ToolBarArea = Qt.TopToolBarArea)

abstract addToolBarIcon(self, qAction: QAction | None) int[source]

Add an icon to the plugins toolbar

Parameters:

qAction (Optional[QAction])

Return type:

int

abstract addToolBarWidget(self, widget: QWidget | None) QAction | None[source]

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

Parameters:

widget (Optional[QWidget]) – widget to add. The toolbar will take ownership of this widget

Return type:

Optional[QAction]

Returns:

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

abstract addUserInputWidget(self, widget: QWidget | None)[source]

Adds a widget to the user input tool bar.

Parameters:

widget (Optional[QWidget])

abstract addVectorLayer(self, vectorLayerPath: str | None, baseName: str | None, providerKey: str | None) QgsVectorLayer | None[source]

Adds a vector layer to the current project, using the specified data provider and source url.

The baseName parameter will be used as the layer name (and shown in the map legend).

Parameters:
  • vectorLayerPath (Optional[str])

  • baseName (Optional[str])

  • providerKey (Optional[str])

Return type:

Optional[QgsVectorLayer]

abstract addVectorTileLayer(self, url: str | None, baseName: str | None) QgsVectorTileLayer | None[source]

Adds a vector tile layer to the current project, using the specified source url.

The baseName parameter will be used as the layer name (and shown in the map legend).

Added in version 3.14.

Parameters:
  • url (Optional[str])

  • baseName (Optional[str])

Return type:

Optional[QgsVectorTileLayer]

abstract addVectorToolBarIcon(self, qAction: QAction | None) int[source]

Add an icon to the Vector toolbar

Parameters:

qAction (Optional[QAction])

Return type:

int

abstract addVectorToolBarWidget(self, widget: QWidget | None) QAction | None[source]

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

Parameters:

widget (Optional[QWidget]) – widget to add. The toolbar will take ownership of this widget

Return type:

Optional[QAction]

Returns:

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

abstract addWebToolBarIcon(self, qAction: QAction | None) int[source]

Add an icon to the Web toolbar

Parameters:

qAction (Optional[QAction])

Return type:

int

abstract addWebToolBarWidget(self, widget: QWidget | None) QAction | None[source]

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

Parameters:

widget (Optional[QWidget]) – widget to add. The toolbar will take ownership of this widget

Return type:

Optional[QAction]

Returns:

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

abstract addWindow(self, action: QAction | None)[source]

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

Parameters:

action (Optional[QAction])

abstract advancedDigitizeToolBar(self) QToolBar | None[source]

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

Return type:

Optional[QToolBar]

abstract askForDatumTransform(self, sourceCrs: QgsCoordinateReferenceSystem, destinationCrs: QgsCoordinateReferenceSystem) bool[source]

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.

Parameters:
abstract attributesToolBar(self) QToolBar | None[source]

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

Return type:

Optional[QToolBar]

abstract blockActiveLayerChanges(self, blocked: bool)[source]

Sets whether changes to the active layer should be temporarily blocked.

This is a low-level method, designed to avoid unnecessary work when adding lots of layers at once. Clients which will be adding many layers may call blockActiveLayerChanges( True ) upfront, add all the layers, and then follow up with a call to blockActiveLayerChanges( False ). This will defer emitting the active layer changed signal until they’ve added all layers, and only emit the signal once for the final layer added.

Warning

This must be accompanied by a subsequent call with blocked as False.

Added in version 3.36.

Parameters:

blocked (bool)

abstract browserModel(self) QgsBrowserGuiModel | None[source]

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

Added in version 3.4.

Return type:

Optional[QgsBrowserGuiModel]

abstract buildStyleSheet(self, opts: Dict[str | None, Any])[source]

Generate stylesheet

Parameters:

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

abstract cadDockWidget(self) QgsAdvancedDigitizingDockWidget | None[source]

Advanced digitizing dock widget

Return type:

Optional[QgsAdvancedDigitizingDockWidget]

abstract closeMapCanvas(self, name: str | None)[source]

Closes the additional map canvas with matching name.

Parameters:

name (Optional[str])

abstract closeMapCanvas3D(self, name: str | None)[source]

Closes the additional map canvas with matching name.

Added in version 3.36.

Parameters:

name (Optional[str])

abstract copySelectionToClipboard(self, a0: QgsMapLayer | None)[source]

Copy selected features from the layer to clipboard

Parameters:

a0 (Optional[QgsMapLayer])

abstract createNewMapCanvas(self, name: str | None) QgsMapCanvas | None[source]

Create a new map canvas with the specified unique name.

See also

closeMapCanvas()

Parameters:

name (Optional[str])

Return type:

Optional[QgsMapCanvas]

abstract createNewMapCanvas3D(self, name: str | None, sceneMode: Qgis.SceneMode = Qgis.SceneMode.Local) Qgs3DMapCanvas | None[source]

Create a new 3D map canvas with the specified unique name.

Note

Scene mode (local or globe) can be selected since QGIS 3.44.

Added in version 3.36.

Parameters:
  • name (Optional[str])

  • sceneMode (Qgis.SceneMode = Qgis.SceneMode.Local)

Return type:

Optional[Qgs3DMapCanvas]

abstract createProjectModelSubMenu(self, title: str | None) QMenu | None[source]

Creates a new project model submenu in the “Projects” - “Models” submenu.

Added in version 3.42.

Parameters:

title (Optional[str])

Return type:

Optional[QMenu]

signal currentLayerChanged(layer: QgsMapLayer)[source]

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

Parameters:

layer (QgsMapLayer)

signal currentThemeChanged(theme: str)[source]

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

Parameters:

theme (str)

abstract dataSourceManagerToolBar(self) QToolBar | None[source]

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

Added in version 3.4.

Return type:

Optional[QToolBar]

abstract databaseMenu(self) QMenu | None[source]

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

Return type:

Optional[QMenu]

abstract databaseToolBar(self) QToolBar | None[source]

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

Return type:

Optional[QToolBar]

abstract defaultStyleSheetFont(self) QFont[source]

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

Return type:

QFont

abstract defaultStyleSheetOptions(self) Dict[str, Any]

Returns changeable options built from settings and/or defaults

Return type:

Dict[str, Any]

abstract deregisterLocatorFilter(self, filter: QgsLocatorFilter | None)[source]

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.

Parameters:

filter (Optional[QgsLocatorFilter])

abstract digitizeToolBar(self) QToolBar | None[source]

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

Return type:

Optional[QToolBar]

abstract editMenu(self) QMenu | None[source]

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

Return type:

Optional[QMenu]

abstract 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

abstract fileToolBar(self) QToolBar | None[source]

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

Return type:

Optional[QToolBar]

abstract firstRightStandardMenu(self) QMenu | None[source]

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:

Optional[QMenu]

abstract getFeatureForm(self, l: QgsVectorLayer | None, f: QgsFeature) QgsAttributeDialog | None[source]

Returns a feature form for a given feature.

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

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

Return type:

Optional[QgsAttributeDialog]

Returns:

A feature form

abstract gpsTools(self) QgsGpsToolsInterface | None[source]

Returns an interface to allow plugins to use QGIS GPS tools.

Return type:

Optional[QgsGpsToolsInterface]

abstract helpMenu(self) QMenu | None[source]

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

Return type:

Optional[QMenu]

abstract helpToolBar(self) QToolBar | None[source]

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

Return type:

Optional[QToolBar]

abstract iconSize(self, dockedToolbar: bool = False) QSize[source]

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

signal initializationCompleted[source]

Emitted when the initialization is complete.

abstract insertAddLayerAction(self, action: QAction | None)[source]

Add “add layer” action to layer menu

Parameters:

action (Optional[QAction])

abstract invalidateLocatorResults(self)[source]

Invalidate results from the locator filter.

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

Added in version 3.2.

abstract layerMenu(self) QMenu | None[source]

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

Return type:

Optional[QMenu]

signal layerSavedAs(l: QgsMapLayer, path: str)[source]

Emitted when a layer has been saved using save as.

Parameters:
abstract layerToolBar(self) QToolBar | None[source]

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

Return type:

Optional[QToolBar]

abstract layerTreeCanvasBridge(self) QgsLayerTreeMapCanvasBridge | None[source]

Returns a pointer to the layer tree canvas bridge

Return type:

Optional[QgsLayerTreeMapCanvasBridge]

abstract layerTreeInsertionPoint(self) QgsLayerTreeRegistryBridge.InsertionPoint[source]

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

Added in version 3.10.

Return type:

QgsLayerTreeRegistryBridge.InsertionPoint

abstract layerTreeView(self) QgsLayerTreeView | None[source]
Return type:

Optional[QgsLayerTreeView]

signal layoutDesignerClosed[source]

Emitted after a layout designer window is closed.

signal layoutDesignerOpened(designer: QgsLayoutDesignerInterface)[source]

Emitted when a new layout designer has been opened.

Parameters:

designer (QgsLayoutDesignerInterface)

signal layoutDesignerWillBeClosed(designer: QgsLayoutDesignerInterface)[source]

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

Parameters:

designer (QgsLayoutDesignerInterface)

abstract locatorSearch(self, searchText: str | None)[source]

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

Added in version 3.10.

Parameters:

searchText (Optional[str])

abstract mainWindow(self) QWidget | None[source]

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

Return type:

Optional[QWidget]

abstract mapCanvas(self) QgsMapCanvas | None[source]

Returns a pointer to the map canvas

Return type:

Optional[QgsMapCanvas]

abstract mapCanvases(self) List[QgsMapCanvas]

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

Return type:

List[QgsMapCanvas]

abstract mapCanvases3D(self) List[Qgs3DMapCanvas]

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

Added in version 3.36.

Return type:

List[Qgs3DMapCanvas]

abstract mapNavToolToolBar(self) QToolBar | None[source]

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

Return type:

Optional[QToolBar]

abstract mapToolActionGroup(self) QActionGroup | None[source]

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.

Added in version 3.16.

Return type:

Optional[QActionGroup]

abstract meshMenu(self) QMenu | None[source]

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

Added in version 3.34.

Return type:

Optional[QMenu]

abstract messageBar(self) QgsMessageBar | None[source]

Returns the message bar of the main app

Return type:

Optional[QgsMessageBar]

abstract messageTimeout(self) int[source]

Returns the timeout for timed messages: default of 5 seconds

Return type:

int

abstract newLayerMenu(self) QMenu | None[source]

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

Return type:

Optional[QMenu]

abstract newProject(self, promptToSaveFlag: bool = False) bool[source]

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

signal newProjectCreated[source]

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.

abstract openDataSourceManagerPage(self, pageName: str | None)[source]

Opens a page in the main window “Data Source Manager” dialog.

This method creates and opens the dialog if it is not already visible.

Added in version 3.30.

Parameters:

pageName (Optional[str])

abstract openFeatureForm(self, l: QgsVectorLayer | None, f: QgsFeature, updateFeatureOnly: bool = False, showModal: bool = True) bool[source]

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

Parameters:
  • l (Optional[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

abstract openLayoutDesigner(self, layout: QgsMasterLayoutInterface | None) QgsLayoutDesignerInterface | None[source]

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.

Parameters:

layout (Optional[QgsMasterLayoutInterface])

Return type:

Optional[QgsLayoutDesignerInterface]

abstract openLayoutDesigners(self) List[QgsLayoutDesignerInterface]

Returns all currently open layout designers.

Return type:

List[QgsLayoutDesignerInterface]

abstract openMessageLog(self, tabName: str | None = '')[source]

Opens the message log dock widget, and optionally activates a specific tab by name.

Parameters:

tabName (Optional[str] = '') – Name of the tab to be activated (since QGIS 3.44)

abstract openURL(self, url: str | None, useQgisDocDirectory: bool = True)[source]

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 (Optional[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 3.40: Use QDesktopServices instead.

abstract pasteFromClipboard(self, a0: QgsMapLayer | None)[source]

Paste features from clipboard to the layer

Parameters:

a0 (Optional[QgsMapLayer])

abstract pluginHelpMenu(self) QMenu | None[source]

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.

Added in version 3.10.

Return type:

Optional[QMenu]

abstract pluginManagerInterface(self) QgsPluginManagerInterface | None[source]
Return type:

Optional[QgsPluginManagerInterface]

abstract pluginMenu(self) QMenu | None[source]

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

Return type:

Optional[QMenu]

abstract pluginToolBar(self) QToolBar | None[source]

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

Return type:

Optional[QToolBar]

abstract preloadForm(self, uifile: str | None)[source]

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 (Optional[str])

abstract projectImportExportMenu(self) QMenu | None[source]

Returns a reference to the main window “Import/Export” project menu.

Added in version 3.30.

Return type:

Optional[QMenu]

abstract projectMenu(self) QMenu | None[source]

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

Return type:

Optional[QMenu]

abstract projectModelsMenu(self) QMenu | None[source]

Returns a reference to the main window “Projects” - “Models” submenu.

Added in version 3.42.

Return type:

Optional[QMenu]

signal projectRead[source]

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.

abstract rasterMenu(self) QMenu | None[source]

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

Return type:

Optional[QMenu]

abstract rasterToolBar(self) QToolBar | None[source]

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

Return type:

Optional[QToolBar]

abstract registerApplicationExitBlocker(self, blocker: QgsApplicationExitBlockerInterface | None)[source]

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.

Added in version 3.16.

Parameters:

blocker (Optional[QgsApplicationExitBlockerInterface])

abstract registerCustomDropHandler(self, handler: QgsCustomDropHandler | None)[source]

Register a new custom drop handler.

Note

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

Parameters:

handler (Optional[QgsCustomDropHandler])

abstract registerCustomLayoutDropHandler(self, handler: QgsLayoutCustomDropHandler | None)[source]

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.

Parameters:

handler (Optional[QgsLayoutCustomDropHandler])

abstract registerCustomProjectOpenHandler(self, handler: QgsCustomProjectOpenHandler | None)[source]

Register a new custom project open handler.

Note

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

Added in version 3.14.

Parameters:

handler (Optional[QgsCustomProjectOpenHandler])

abstract registerDevToolWidgetFactory(self, factory: QgsDevToolWidgetFactory | None)[source]

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.

Added in version 3.14.

Parameters:

factory (Optional[QgsDevToolWidgetFactory])

abstract registerLocatorFilter(self, filter: QgsLocatorFilter | None)[source]

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.

Parameters:

filter (Optional[QgsLocatorFilter])

abstract registerMainWindowAction(self, action: QAction | None, defaultShortcut: str | None) bool[source]

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

Parameters:
  • action (Optional[QAction])

  • defaultShortcut (Optional[str])

Return type:

bool

abstract registerMapLayerConfigWidgetFactory(self, factory: QgsMapLayerConfigWidgetFactory | None)[source]

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.

Parameters:

factory (Optional[QgsMapLayerConfigWidgetFactory])

abstract registerMapToolHandler(self, handler: QgsAbstractMapToolHandler | None)[source]

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.

Added in version 3.16.

Parameters:

handler (Optional[QgsAbstractMapToolHandler])

abstract registerOptionsWidgetFactory(self, factory: QgsOptionsWidgetFactory | None)[source]

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.

Parameters:

factory (Optional[QgsOptionsWidgetFactory])

abstract registerProjectPropertiesWidgetFactory(self, factory: QgsOptionsWidgetFactory | None)[source]

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.

Added in version 3.16.

Parameters:

factory (Optional[QgsOptionsWidgetFactory])

abstract reloadConnections(self)[source]

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)

abstract removeAddLayerAction(self, action: QAction | None)[source]

Remove “add layer” action from layer menu

Parameters:

action (Optional[QAction])

abstract removeCustomActionForLayerType(self, action: QAction | None) bool[source]

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

Parameters:

action (Optional[QAction])

Return type:

bool

abstract removeDatabaseToolBarIcon(self, qAction: QAction | None)[source]

Remove an action (icon) from the Database toolbar

Parameters:

qAction (Optional[QAction])

abstract removeDockWidget(self, dockwidget: QDockWidget | None)[source]

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

See also

addDockWidget()

Parameters:

dockwidget (Optional[QDockWidget])

abstract removePluginDatabaseMenu(self, name: str | None, action: QAction | None)[source]

Remove action from the Database menu

Parameters:
  • name (Optional[str])

  • action (Optional[QAction])

abstract removePluginMenu(self, name: str | None, action: QAction | None)[source]

Remove action from the plugins menu

Parameters:
  • name (Optional[str])

  • action (Optional[QAction])

abstract removePluginMeshMenu(self, name: str | None, action: QAction | None)[source]

Remove action from the Mesh menu

Added in version 3.24.

Parameters:
  • name (Optional[str])

  • action (Optional[QAction])

abstract removePluginRasterMenu(self, name: str | None, action: QAction | None)[source]

Remove action from the Raster menu

Parameters:
  • name (Optional[str])

  • action (Optional[QAction])

abstract removePluginVectorMenu(self, name: str | None, action: QAction | None)[source]

Remove action from the Vector menu

Parameters:
  • name (Optional[str])

  • action (Optional[QAction])

abstract removePluginWebMenu(self, name: str | None, action: QAction | None)[source]

Remove action from the Web menu

Parameters:
  • name (Optional[str])

  • action (Optional[QAction])

abstract removeProjectExportAction(self, action: QAction | None)[source]

Adds an action to the QGIS “Export project” menu.

Added in version 3.30.

Parameters:

action (Optional[QAction])

abstract removeProjectImportAction(self, action: QAction | None)[source]

Adds an action to the QGIS “Import project” menu.

Added in version 3.30.

Parameters:

action (Optional[QAction])

abstract removeRasterToolBarIcon(self, qAction: QAction | None)[source]

Remove an action (icon) from the Raster toolbar

Parameters:

qAction (Optional[QAction])

abstract removeToolBarIcon(self, qAction: QAction | None)[source]

Remove an action (icon) from the plugin toolbar

Parameters:

qAction (Optional[QAction])

abstract removeVectorToolBarIcon(self, qAction: QAction | None)[source]

Remove an action (icon) from the Vector toolbar

Parameters:

qAction (Optional[QAction])

abstract removeWebToolBarIcon(self, qAction: QAction | None)[source]

Remove an action (icon) from the Web toolbar

Parameters:

qAction (Optional[QAction])

abstract removeWindow(self, action: QAction | None)[source]

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

Parameters:

action (Optional[QAction])

abstract saveStyleSheetOptions(self, opts: Dict[str | None, Any])[source]

Save changed default option keys/values to user settings

Parameters:

opts (Dict[Optional[str], Any])

abstract selectionToolBar(self) QToolBar | None[source]

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

Added in version 3.14.

Return type:

Optional[QToolBar]

abstract setActiveLayer(self, a0: QgsMapLayer | None) bool[source]

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

Parameters:

a0 (Optional[QgsMapLayer])

Return type:

bool

abstract setGpsPanelConnection(self, connection: QgsGpsConnection | None)[source]

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

Deprecated since version 3.44: Use the method from gpsTools() instead.

Added in version 3.16.

Parameters:

connection (Optional[QgsGpsConnection])

abstract settingsMenu(self) QMenu | None[source]

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

Return type:

Optional[QMenu]

abstract shapeDigitizeToolBar(self) QToolBar | None[source]

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

Return type:

Optional[QToolBar]

abstract showApiDocumentation(self, api: Qgis.DocumentationApi = Qgis.DocumentationApi.PyQgis, browser: Qgis.DocumentationBrowser = Qgis.DocumentationBrowser.DeveloperToolsPanel, object: str | None = '', module: str | None = '')[source]

Show a page of the API documentation

Parameters:
  • api (Qgis.DocumentationApi = Qgis.DocumentationApi.PyQgis) – Which API to display

  • browser (Qgis.DocumentationBrowser = Qgis.DocumentationBrowser.DeveloperToolsPanel) – Web browser used to display the API documentation

  • object (Optional[str] = '') – object to show in the documentation

  • module (Optional[str] = '') – used only if api = Qgis.DocumentationApi.PyQgis

Added in version 3.42.

abstract showAttributeTable(self, l: QgsVectorLayer | None, filterExpression: str | None = '') QDialog | None[source]

Open attribute table dialog

Parameters:
Return type:

Optional[QDialog]

abstract showLayerProperties(self, l: QgsMapLayer | None, page: str | None = '')[source]

Opens layer properties dialog for the layer l. Optionally, a page to open can be specified (since QGIS 3.20). The list below contains valid page names:

Vector Layer: mOptsPage_Information, mOptsPage_Source, mOptsPage_Style, mOptsPage_Labels, mOptsPage_Masks, mOptsPage_Diagrams, mOptsPage_SourceFields, mOptsPage_AttributesForm, mOptsPage_Joins, mOptsPage_AuxiliaryStorage, mOptsPage_Actions, mOptsPage_Display, mOptsPage_Rendering, mOptsPage_Temporal, mOptsPage_Variables, mOptsPage_Elevation, mOptsPage_Metadata, mOptsPage_DataDependencies, mOptsPage_Legend, mOptsPage_Server

Raster Layer: mOptsPage_Information, mOptsPage_Source, mOptsPage_Style, mOptsPage_Transparency, mOptsPage_Histogram, mOptsPage_Rendering, mOptsPage_Temporal, mOptsPage_Pyramids, mOptsPage_Elevation, mOptsPage_Metadata, mOptsPage_Legend, mOptsPage_Server

Mesh Layer: mOptsPage_Information, mOptsPage_Source, mOptsPage_Style, mOptsPage_StyleContent, mOptsPage_Rendering, mOptsPage_Temporal, mOptsPage_Elevation, mOptsPage_Metadata

Point Cloud Layer: mOptsPage_Information, mOptsPage_Source, mOptsPage_Elevation, mOptsPage_Metadata, mOptsPage_Statistics, mOptsPage_Rendering

Vector Tile Layer: mOptsPage_Information, mOptsPage_Style, mOptsPage_Labeling, mOptsPage_Metadata

Note

Page names are subject to change without notice between QGIS versions, they are not considered part of the stable API.

Note

More strings may be available depending on the context, e.g. via plugins.

Parameters:
abstract showLayoutManager(self)[source]

Opens the layout manager dialog.

abstract showOptionsDialog(self, parent: QWidget | None = None, currentPage: str | None = '')[source]

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

Parameters:
  • parent (Optional[QWidget] = None)

  • currentPage (Optional[str] = '')

abstract showProjectPropertiesDialog(self, currentPage: str | None = '')[source]

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

Added in version 3.16.

Parameters:

currentPage (Optional[str] = '')

abstract statusBarIface(self) QgsStatusBar | None[source]

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).

Return type:

Optional[QgsStatusBar]

virtual takeAppScreenShots(self, saveDirectory: str | None, categories: int = 0)[source]

Take screenshots for user documentation

Parameters:
  • saveDirectory (Optional[str]) – path where the screenshots will be saved

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

Added in version 3.4.

abstract unregisterApplicationExitBlocker(self, blocker: QgsApplicationExitBlockerInterface | None)[source]

Unregister a previously registered application exit blocker.

Added in version 3.16.

Parameters:

blocker (Optional[QgsApplicationExitBlockerInterface])

abstract unregisterCustomDropHandler(self, handler: QgsCustomDropHandler | None)[source]

Unregister a previously registered custom drop handler.

Parameters:

handler (Optional[QgsCustomDropHandler])

abstract unregisterCustomLayoutDropHandler(self, handler: QgsLayoutCustomDropHandler | None)[source]

Unregister a previously registered custom drop handler for layout windows.

Parameters:

handler (Optional[QgsLayoutCustomDropHandler])

abstract unregisterCustomProjectOpenHandler(self, handler: QgsCustomProjectOpenHandler | None)[source]

Unregister a previously registered custom project open handler.

Added in version 3.14.

Parameters:

handler (Optional[QgsCustomProjectOpenHandler])

abstract unregisterDevToolWidgetFactory(self, factory: QgsDevToolWidgetFactory | None)[source]

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

Added in version 3.14.

Parameters:

factory (Optional[QgsDevToolWidgetFactory])

abstract unregisterMainWindowAction(self, action: QAction | None) bool[source]

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

Parameters:

action (Optional[QAction])

Return type:

bool

abstract unregisterMapLayerConfigWidgetFactory(self, factory: QgsMapLayerConfigWidgetFactory | None)[source]

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

Parameters:

factory (Optional[QgsMapLayerConfigWidgetFactory])

abstract unregisterMapToolHandler(self, handler: QgsAbstractMapToolHandler | None)[source]

Unregister a previously registered map tool handler.

Added in version 3.16.

Parameters:

handler (Optional[QgsAbstractMapToolHandler])

abstract unregisterOptionsWidgetFactory(self, factory: QgsOptionsWidgetFactory | None)[source]

Unregister a previously registered tab in the options dialog.

Parameters:

factory (Optional[QgsOptionsWidgetFactory])

abstract unregisterProjectPropertiesWidgetFactory(self, factory: QgsOptionsWidgetFactory | None)[source]

Unregister a previously registered tab in the options dialog.

Added in version 3.16.

Parameters:

factory (Optional[QgsOptionsWidgetFactory])

abstract userProfileManager(self) QgsUserProfileManager | None[source]

Returns a reference to the user profile manager

Added in version 3.30.

Return type:

Optional[QgsUserProfileManager]

abstract vectorLayerTools(self) QgsVectorLayerTools | None[source]

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:

Optional[QgsVectorLayerTools]

Returns:

An instance of the vector layer tools

abstract vectorMenu(self) QMenu | None[source]

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

Return type:

Optional[QMenu]

abstract vectorToolBar(self) QToolBar | None[source]

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

Return type:

Optional[QToolBar]

abstract viewMenu(self) QMenu | None[source]

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

Return type:

Optional[QMenu]

abstract webMenu(self) QMenu | None[source]

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

Return type:

Optional[QMenu]

abstract webToolBar(self) QToolBar | None[source]

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

Return type:

Optional[QToolBar]

abstract windowMenu(self) QMenu | None[source]

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

Return type:

Optional[QMenu]

abstract zoomFull(self)[source]

Zooms to the full extent of all map layers.

abstract zoomToActiveLayer(self)[source]

Zooms to extent of the active layer.

abstract zoomToNext(self)[source]

Zooms to the next view extent.

abstract zoomToPrevious(self)[source]

Zooms to the previous view extent.