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¶
Base classes¶
- class qgis.gui.QgisInterface[source]¶
Bases:
QObject- abstract actionAddAfsLayer(self) QAction | None[source]¶
Returns the native Add ArcGIS REST Server action.
- 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 actionAddPart(self) QAction | None[source]¶
Returns the native Add Part action.
- 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 actionAddRing(self) QAction | None[source]¶
Returns the native Add Ring action.
- 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 actionAddXyzLayer(self) QAction | None[source]¶
Returns the native Add XYZ Layer action.
Added in version 3.14.
- 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 thenQgsMapToolCapture.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 thenQgsMapToolCapture.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 thenQgsMapToolCapture.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 thenQgsMapToolCapture.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 thenQgsMapToolCapture.setCurrentShapeMapTool().- Return type:
Optional[QAction]
- abstract actionCopyFeatures(self) QAction | None[source]¶
Returns the native Copy Features action.
- Return type:
Optional[QAction]
- abstract actionCreatePrintLayout(self) QAction | None[source]¶
Create new print layout action
- 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]
- 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 thenQgsMapToolCapture.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 thenQgsMapToolCapture.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 thenQgsMapToolCapture.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 thenQgsMapToolCapture.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 actionHideDeselectedLayers(self) QAction | None[source]¶
Returns the Hide Deselected Layers action.
- 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 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 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 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 actionProjectProperties(self) QAction | None[source]¶
Returns the native Project Properties action.
- 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 thenQgsMapToolCapture.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 thenQgsMapToolCapture.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 thenQgsMapToolCapture.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 thenQgsMapToolCapture.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 thenQgsMapToolCapture.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 thenQgsMapToolCapture.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 thenQgsMapToolCapture.setCurrentShapeMapTool().- 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 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 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 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.
See also
- Return type:
Optional[QAction]
- abstract actionVertexToolActiveLayer(self) QAction | None[source]¶
Returns the native “Vertex Tool for Active Layer” action.
See also
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:
- 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.See also
- 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 withaddCustomActionForLayer()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.
See also
See also
- 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
dockwidget to the main window, in the specified dockarea.See also
See also
- 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
baseNameparameter 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
baseNameparameter 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
actionto the QGIS “Export project” menu.See also
See also
Added in version 3.30.
- Parameters:
action (Optional[QAction])
- abstract addProjectImportAction(self, action: QAction | None)[source]¶
Adds an
actionto the QGIS “Import project” menu.See also
See also
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
baseNameparameter will be used as the layer name (and shown in the map legend).addRasterLayer(self, url: Optional[str], layerName: Optional[str], providerKey: Optional[str]) -> Optional[QgsRasterLayer] Adds a raster layer to the current project, from the specified raster data provider and source
url.The
layerNameparameter 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 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 unlessraiseTabis passed asTrue.tabifyWithis 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 thatarea(or iftabifyWithis not given at all), the new dock widget will be created anyways, but its location within thatareawill 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
baseNameparameter 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
addToolBar(self, toolbar: Optional[QToolBar], area: Qt.ToolBarArea = Qt.TopToolBarArea) Add a toolbar
- Parameters:
name (Optional[str])
- Return type:
Optional[QToolBar]
- 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
baseNameparameter 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
baseNameparameter 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:
Trueif a datum transform has been specifically chosen by user or only one is available.- Parameters:
sourceCrs (QgsCoordinateReferenceSystem)
destinationCrs (QgsCoordinateReferenceSystem)
- 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
blockedasFalse.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.See also
- Parameters:
name (Optional[str])
- abstract closeMapCanvas3D(self, name: str | None)[source]¶
Closes the additional map canvas with matching
name.See also
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
- 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.
See also
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[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- signal currentThemeChanged[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- 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
filterfrom 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.See also
- 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:
- 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
dockedToolbarisTrue, the icon size for toolbars contained within docks is returned.- Parameters:
dockedToolbar (bool = False)
- Return type:
QSize
- signal initializationCompleted[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- 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[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- 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:
- abstract layerTreeView(self) QgsLayerTreeView | None[source]¶
- Return type:
Optional[QgsLayerTreeView]
- signal layoutDesignerClosed[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- signal layoutDesignerOpened[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- signal layoutDesignerWillBeClosed[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- abstract locatorSearch(self, searchText: str | None)[source]¶
This will perform a search in the locator bar by setting the line edit text to
searchTextand 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
QgisAppin 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:
- abstract mapCanvases3D(self) List[Qgs3DMapCanvas]¶
Returns a list of all 3D map canvases open in the app.
Added in version 3.36.
- Return type:
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
promptToSaveFlagisTruethen users will be prompted to save any currently open project (if that project has changes). If the flag isFalse, then the current project will be closed without prompting to save (possibly resulting in data loss).Since QGIS 3.10.1, returns
Trueif a new project was created, orFalseif 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]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- 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
Trueif dialog was accepted (if shown modal,Trueotherwise).- 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:
- 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.
See also
See also
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]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- 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
blockeris not transferred, and the blocker must be unregistered when plugin is unloaded.See also
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
handleris not transferred, and the handler must be unregistered when plugin is unloaded.See also
See also
- Parameters:
handler (Optional[QgsCustomDropHandler])
- abstract registerCustomLayoutDropHandler(self, handler: QgsLayoutCustomDropHandler | None)[source]¶
Register a new custom drop
handlerfor layout windows.Note
Ownership of
handleris not transferred, and the handler must be unregistered when plugin is unloaded.See also
See also
- Parameters:
handler (Optional[QgsLayoutCustomDropHandler])
- abstract registerCustomProjectOpenHandler(self, handler: QgsCustomProjectOpenHandler | None)[source]¶
Register a new custom project open
handler.Note
Ownership of
handleris not transferred, and the handler must be unregistered when plugin is unloaded.See also
See also
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.
See also
Added in version 3.14.
- Parameters:
factory (Optional[QgsDevToolWidgetFactory])
- abstract registerLocatorFilter(self, filter: QgsLocatorFilter | None)[source]¶
Registers a locator
filterfor 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.See also
- 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.
See also
- 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
handleris not transferred, and the handler must be unregistered when plugin is unloaded.See also
See also
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.
See also
See also
- 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.
See also
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()See also
- 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
dockwidget from main window (without deleting it).See also
- 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
actionto the QGIS “Export project” menu.See also
See also
Added in version 3.30.
- Parameters:
action (Optional[QAction])
- abstract removeProjectImportAction(self, action: QAction | None)[source]¶
Adds an
actionto the QGIS “Import project” menu.See also
See also
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
Trueif the layer exists,Falseotherwise- Parameters:
a0 (Optional[QgsMapLayer])
- Return type:
bool
- abstract setGpsPanelConnection(self, connection: QgsGpsConnection | None)[source]¶
Sets a GPS
connectionto 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:
l (Optional[QgsVectorLayer])
filterExpression (Optional[str] = '')
- Return type:
Optional[QDialog]
- abstract showLayerProperties(self, l: QgsMapLayer | None, page: str | None = '')[source]¶
Opens layer properties dialog for the layer
l. Optionally, apageto 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:
l (Optional[QgsMapLayer])
page (Optional[str] = '')
- abstract showOptionsDialog(self, parent: QWidget | None = None, currentPage: str | None = '')[source]¶
Opens the options dialog. The
currentPageargument 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
currentPageargument 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.See also
Added in version 3.16.
- Parameters:
blocker (Optional[QgsApplicationExitBlockerInterface])
- abstract unregisterCustomDropHandler(self, handler: QgsCustomDropHandler | None)[source]¶
Unregister a previously registered custom drop
handler.See also
See also
- Parameters:
handler (Optional[QgsCustomDropHandler])
- abstract unregisterCustomLayoutDropHandler(self, handler: QgsLayoutCustomDropHandler | None)[source]¶
Unregister a previously registered custom drop
handlerfor layout windows.See also
See also
- Parameters:
handler (Optional[QgsLayoutCustomDropHandler])
- abstract unregisterCustomProjectOpenHandler(self, handler: QgsCustomProjectOpenHandler | None)[source]¶
Unregister a previously registered custom project open
handler.See also
See also
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.
See also
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.
See also
- Parameters:
factory (Optional[QgsMapLayerConfigWidgetFactory])
- abstract unregisterMapToolHandler(self, handler: QgsAbstractMapToolHandler | None)[source]¶
Unregister a previously registered map tool
handler.See also
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.
See also
See also
- Parameters:
factory (Optional[QgsOptionsWidgetFactory])
- abstract unregisterProjectPropertiesWidgetFactory(self, factory: QgsOptionsWidgetFactory | None)[source]¶
Unregister a previously registered tab in the options dialog.
See also
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]