Class: QgisInterface¶
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.
Class Hierarchy¶
Base classes¶
- class qgis.gui.QgisInterface[source]¶
Bases:
QObject- actionAddAfsLayer(self) QAction | None[source]¶
Returns the native Add ArcGIS REST Server action.
- Return type:
Optional[QAction]
- actionAddAmsLayer(self) QAction | None[source]¶
Returns the native Add ArcGIS REST Server action.
- Return type:
Optional[QAction]
- actionAddFeature(self) QAction | None[source]¶
Returns the native Add Feature action.
- Return type:
Optional[QAction]
- actionAddPart(self) QAction | None[source]¶
Returns the native Add Part action.
- Return type:
Optional[QAction]
- actionAddPointCloudLayer(self) QAction | None[source]¶
Returns the native Add Point Cloud Layer action.
Added in version 3.18.
- Return type:
Optional[QAction]
- actionAddRing(self) QAction | None[source]¶
Returns the native Add Ring action.
- Return type:
Optional[QAction]
- actionAddVectorTileLayer(self) QAction | None[source]¶
Returns the native Add Vector Tile Layer action.
Added in version 3.14.
- Return type:
Optional[QAction]
- actionAddXyzLayer(self) QAction | None[source]¶
Returns the native Add XYZ Layer action.
Added in version 3.14.
- Return type:
Optional[QAction]
- 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]
- 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]
- 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]
- 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]
- 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]
- actionCopyFeatures(self) QAction | None[source]¶
Returns the native Copy Features action.
- Return type:
Optional[QAction]
- actionCreatePrintLayout(self) QAction | None[source]¶
Create new print layout action
- Return type:
Optional[QAction]
- actionCutFeatures(self) QAction | None[source]¶
Returns the native Cut Features action.
- Return type:
Optional[QAction]
- actionDeletePart(self) QAction | None[source]¶
Returns the native Delete Part action.
- Return type:
Optional[QAction]
- actionDeleteRing(self) QAction | None[source]¶
Returns the native Delete Ring action.
- Return type:
Optional[QAction]
- actionDeleteSelected(self) QAction | None[source]¶
Returns the native Delete Selected Features action.
- Return type:
Optional[QAction]
- actionDraw(self) QAction | None[source]¶
Returns the native draw action.
- Return type:
Optional[QAction]
- 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]
- 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]
- 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]
- 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]
- actionExit(self) QAction | None[source]¶
Returns the Exit QGIS action.
- Return type:
Optional[QAction]
- 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]
- actionHideDeselectedLayers(self) QAction | None[source]¶
Returns the Hide Deselected Layers action.
- Return type:
Optional[QAction]
- 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]
- actionMapTips(self) QAction | None[source]¶
Returns the native map tips action. Call
trigger()on it to toggle map tips.- Return type:
Optional[QAction]
- 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]
- 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]
- actionMoveFeature(self) QAction | None[source]¶
Returns the native Move Features action.
- Return type:
Optional[QAction]
- 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]
- actionNewProject(self) QAction | None[source]¶
Returns the native New Project action.
- Return type:
Optional[QAction]
- actionOpenProject(self) QAction | None[source]¶
Returns the Open Project action.
- Return type:
Optional[QAction]
- actionOpenStatisticalSummary(self) QAction | None[source]¶
Statistical summary action.
- Return type:
Optional[QAction]
- 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]
- 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]
- actionPasteFeatures(self) QAction | None[source]¶
Returns the native Paste Features action.
- Return type:
Optional[QAction]
- actionProjectProperties(self) QAction | None[source]¶
Returns the native Project Properties action.
- Return type:
Optional[QAction]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- actionSaveMapAsImage(self) QAction | None[source]¶
Returns the native Save Map as Image action.
- Return type:
Optional[QAction]
- actionSaveProject(self) QAction | None[source]¶
Returns the native Save Project action.
- Return type:
Optional[QAction]
- actionSaveProjectAs(self) QAction | None[source]¶
Returns the native Save Project As action.
- Return type:
Optional[QAction]
- 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]
- 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]
- 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]
- 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]
- 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]
- actionShowBookmarks(self) QAction | None[source]¶
Returns the native show bookmarks action. Call
trigger()on it to open the bookmarks dialog.- Return type:
Optional[QAction]
- actionShowLayoutManager(self) QAction | None[source]¶
Show layout manager action
- Return type:
Optional[QAction]
- actionSimplifyFeature(self) QAction | None[source]¶
Returns the native Simplify/Smooth Features action.
- Return type:
Optional[QAction]
- actionSplitFeatures(self) QAction | None[source]¶
Returns the native Split Features action.
- Return type:
Optional[QAction]
- actionSplitParts(self) QAction | None[source]¶
Returns the native Split Parts action.
- Return type:
Optional[QAction]
- actionToggleSelectedLayers(self) QAction | None[source]¶
Returns the Toggle Selected Layers action.
Added in version 3.14.
- Return type:
Optional[QAction]
- actionToggleSelectedLayersIndependently(self) QAction | None[source]¶
Returns the Toggle Selected Layers Independently action.
Added in version 3.14.
- Return type:
Optional[QAction]
- actionVertexTool(self) QAction | None[source]¶
Returns the native “Vertex Tool for All Layers” action.
See also
- Return type:
Optional[QAction]
- 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]
- 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]
- 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]
- 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]
- actionZoomLast(self) QAction | None[source]¶
Returns the native zoom last action. Call
trigger()on it to zoom to last.- Return type:
Optional[QAction]
- actionZoomNext(self) QAction | None[source]¶
Returns the native zoom next action. Call
trigger()on it to zoom to next.- Return type:
Optional[QAction]
- 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]
- 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]
- 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]
- 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]
- activeDecorations(self) List[QgsMapDecoration]¶
Returns a list of the active decorations.
Added in version 3.22.
- Return type:
- activeLayer(self) QgsMapLayer | None[source]¶
Returns a pointer to the active layer (layer selected in the legend)
- Return type:
Optional[QgsMapLayer]
- 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])
- 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)
- addDatabaseToolBarIcon(self, qAction: QAction | None) int[source]¶
Add an icon to the Database toolbar
- Parameters:
qAction (Optional[QAction])
- Return type:
int
- 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
- 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])
- addLayerMenu(self) QMenu | None[source]¶
Returns a reference to the main window “Add Layer” menu.
- Return type:
Optional[QMenu]
- 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]
- addPluginToDatabaseMenu(self, name: str | None, action: QAction | None)[source]¶
Add action to the Database menu
- Parameters:
name (Optional[str])
action (Optional[QAction])
- addPluginToMenu(self, name: str | None, action: QAction | None)[source]¶
Add action to the plugins menu
- Parameters:
name (Optional[str])
action (Optional[QAction])
- 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])
- addPluginToRasterMenu(self, name: str | None, action: QAction | None)[source]¶
Add action to the Raster menu
- Parameters:
name (Optional[str])
action (Optional[QAction])
- addPluginToVectorMenu(self, name: str | None, action: QAction | None)[source]¶
Add action to the Vector menu
- Parameters:
name (Optional[str])
action (Optional[QAction])
- addPluginToWebMenu(self, name: str | None, action: QAction | None)[source]¶
Add action to the Web menu
- Parameters:
name (Optional[str])
action (Optional[QAction])
- 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]
- addProject(self, project: str | None) bool[source]¶
Adds (opens) a project
- Parameters:
project (Optional[str])
- Return type:
bool
- 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])
- 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])
- 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]
- addRasterToolBarIcon(self, qAction: QAction | None) int[source]¶
Add an icon to the Raster toolbar
- Parameters:
qAction (Optional[QAction])
- Return type:
int
- 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
- 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)
- 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]
- 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]
- addToolBarIcon(self, qAction: QAction | None) int[source]¶
Add an icon to the plugins toolbar
- Parameters:
qAction (Optional[QAction])
- Return type:
int
- 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
- addUserInputWidget(self, widget: QWidget | None)[source]¶
Adds a widget to the user input tool bar.
- Parameters:
widget (Optional[QWidget])
- 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]
- 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]
- addVectorToolBarIcon(self, qAction: QAction | None) int[source]¶
Add an icon to the Vector toolbar
- Parameters:
qAction (Optional[QAction])
- Return type:
int
- 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
- addWebToolBarIcon(self, qAction: QAction | None) int[source]¶
Add an icon to the Web toolbar
- Parameters:
qAction (Optional[QAction])
- Return type:
int
- 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
- 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])
- advancedDigitizeToolBar(self) QToolBar | None[source]¶
Returns a reference to the main window “Advanced Digitizing” toolbar.
- Return type:
Optional[QToolBar]
- 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)
- attributesToolBar(self) QToolBar | None[source]¶
Returns a reference to the main window “Attributes” toolbar.
- Return type:
Optional[QToolBar]
- 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)
- 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]
- 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
- cadDockWidget(self) QgsAdvancedDigitizingDockWidget | None[source]¶
Advanced digitizing dock widget
- Return type:
Optional[QgsAdvancedDigitizingDockWidget]
- closeMapCanvas(self, name: str | None)[source]¶
Closes the additional map canvas with matching
name.See also
- Parameters:
name (Optional[str])
- 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])
- copySelectionToClipboard(self, a0: QgsMapLayer | None)[source]¶
Copy selected features from the layer to clipboard
- Parameters:
a0 (Optional[QgsMapLayer])
- 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]
- createNewMapCanvas3D(self, name: str | None) Qgs3DMapCanvas | None[source]¶
Create a new 3D map canvas with the specified unique
name.See also
Added in version 3.36.
- Parameters:
name (Optional[str])
- Return type:
Optional[Qgs3DMapCanvas]
- 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.
- 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]
- databaseMenu(self) QMenu | None[source]¶
Returns a reference to the main window “Database” menu.
- Return type:
Optional[QMenu]
- databaseToolBar(self) QToolBar | None[source]¶
Returns a reference to the main window “Database” toolbar.
- Return type:
Optional[QToolBar]
- defaultStyleSheetFont(self) QFont[source]¶
Returns a reference font for initial qApp (may not be same as
QgisApp)- Return type:
QFont
- defaultStyleSheetOptions(self) Dict[str, Any]¶
Returns changeable options built from settings and/or defaults
- Return type:
Dict[str, Any]
- deregisterLocatorFilter(self, filter: QgsLocatorFilter | 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])
- digitizeToolBar(self) QToolBar | None[source]¶
Returns a reference to the main window “Digitize” toolbar.
- Return type:
Optional[QToolBar]
- editMenu(self) QMenu | None[source]¶
Returns a reference to the main window “Edit” menu.
- Return type:
Optional[QMenu]
- editableLayers(self, modified: bool = False) List[QgsMapLayer]¶
Returns vector layers in edit mode
- Parameters:
modified (bool = False) – whether to return only layers that have been modified
- Return type:
- Returns:
list of layers in legend order, or empty list
- fileToolBar(self) QToolBar | None[source]¶
Returns a reference to the main window “File” toolbar.
- Return type:
Optional[QToolBar]
- 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]
- 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
- helpMenu(self) QMenu | None[source]¶
Returns a reference to the main window “Help” menu.
- Return type:
Optional[QMenu]
- helpToolBar(self) QToolBar | None[source]¶
Returns a reference to the main window “Help” toolbar.
- Return type:
Optional[QToolBar]
- 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.
- insertAddLayerAction(self, action: QAction | None)[source]¶
Add “add layer” action to layer menu
- Parameters:
action (Optional[QAction])
- 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.
- 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.
- layerToolBar(self) QToolBar | None[source]¶
Returns a reference to the main window “Layer” toolbar.
- Return type:
Optional[QToolBar]
- layerTreeCanvasBridge(self) QgsLayerTreeMapCanvasBridge | None[source]¶
Returns a pointer to the layer tree canvas bridge
- Return type:
Optional[QgsLayerTreeMapCanvasBridge]
- 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:
- 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.
- 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])
- mainWindow(self) QWidget | None[source]¶
Returns a pointer to the main window (instance of
QgisAppin case of QGIS)- Return type:
Optional[QWidget]
- mapCanvas(self) QgsMapCanvas | None[source]¶
Returns a pointer to the map canvas
- Return type:
Optional[QgsMapCanvas]
- mapCanvases(self) List[QgsMapCanvas]¶
Returns a list of all map canvases open in the app.
- Return type:
- 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]
- 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]
- meshMenu(self) QMenu | None[source]¶
Returns a reference to the main window “Mesh” menu.
Added in version 3.34.
- Return type:
Optional[QMenu]
- messageBar(self) QgsMessageBar | None[source]¶
Returns the message bar of the main app
- Return type:
Optional[QgsMessageBar]
- messageTimeout(self) int[source]¶
Returns the timeout for timed messages: default of 5 seconds
- Return type:
int
- newLayerMenu(self) QMenu | None[source]¶
Returns a reference to the main window “Create New Layer” menu.
- Return type:
Optional[QMenu]
- 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.
- 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])
- 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
- 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]
- openLayoutDesigners(self) List[QgsLayoutDesignerInterface]¶
Returns all currently open layout designers.
- Return type:
- 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.
- pasteFromClipboard(self, a0: QgsMapLayer | None)[source]¶
Paste features from clipboard to the layer
- Parameters:
a0 (Optional[QgsMapLayer])
- 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]
- pluginManagerInterface(self) QgsPluginManagerInterface | None[source]¶
- Return type:
Optional[QgsPluginManagerInterface]
- pluginMenu(self) QMenu | None[source]¶
Returns a reference to the main window “Plugin” menu.
- Return type:
Optional[QMenu]
- pluginToolBar(self) QToolBar | None[source]¶
Returns a reference to the main window “Plugin” toolbar.
- Return type:
Optional[QToolBar]
- 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])
- 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]
- projectMenu(self) QMenu | None[source]¶
Returns a reference to the main window “Project” menu.
- 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.
- rasterMenu(self) QMenu | None[source]¶
Returns a reference to the main window “Raster” menu.
- Return type:
Optional[QMenu]
- rasterToolBar(self) QToolBar | None[source]¶
Returns a reference to the main window “Raster” toolbar.
- Return type:
Optional[QToolBar]
- 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])
- 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])
- 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])
- 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])
- 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])
- 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])
- 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
- 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])
- 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])
- 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])
- 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])
- 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)
- removeAddLayerAction(self, action: QAction | None)[source]¶
Remove “add layer” action from layer menu
- Parameters:
action (Optional[QAction])
- 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
- removeDatabaseToolBarIcon(self, qAction: QAction | None)[source]¶
Remove an action (icon) from the Database toolbar
- Parameters:
qAction (Optional[QAction])
- removeDockWidget(self, dockwidget: QDockWidget | None)[source]¶
Removes the specified
dockwidget from main window (without deleting it).See also
- Parameters:
dockwidget (Optional[QDockWidget])
- removePluginDatabaseMenu(self, name: str | None, action: QAction | None)[source]¶
Remove action from the Database menu
- Parameters:
name (Optional[str])
action (Optional[QAction])
- removePluginMenu(self, name: str | None, action: QAction | None)[source]¶
Remove action from the plugins menu
- Parameters:
name (Optional[str])
action (Optional[QAction])
- 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])
- removePluginRasterMenu(self, name: str | None, action: QAction | None)[source]¶
Remove action from the Raster menu
- Parameters:
name (Optional[str])
action (Optional[QAction])
- removePluginVectorMenu(self, name: str | None, action: QAction | None)[source]¶
Remove action from the Vector menu
- Parameters:
name (Optional[str])
action (Optional[QAction])
- removePluginWebMenu(self, name: str | None, action: QAction | None)[source]¶
Remove action from the Web menu
- Parameters:
name (Optional[str])
action (Optional[QAction])
- 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])
- 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])
- removeRasterToolBarIcon(self, qAction: QAction | None)[source]¶
Remove an action (icon) from the Raster toolbar
- Parameters:
qAction (Optional[QAction])
- removeToolBarIcon(self, qAction: QAction | None)[source]¶
Remove an action (icon) from the plugin toolbar
- Parameters:
qAction (Optional[QAction])
- removeVectorToolBarIcon(self, qAction: QAction | None)[source]¶
Remove an action (icon) from the Vector toolbar
- Parameters:
qAction (Optional[QAction])
- removeWebToolBarIcon(self, qAction: QAction | None)[source]¶
Remove an action (icon) from the Web toolbar
- Parameters:
qAction (Optional[QAction])
- 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])
- saveStyleSheetOptions(self, opts: Dict[str | None, Any])[source]¶
Save changed default option keys/values to user settings
- Parameters:
opts (Dict[Optional[str], Any])
- selectionToolBar(self) QToolBar | None[source]¶
Returns a reference to the main window “Selection” toolbar.
Added in version 3.14.
- Return type:
Optional[QToolBar]
- 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
- 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().Added in version 3.16.
- Parameters:
connection (Optional[QgsGpsConnection])
- settingsMenu(self) QMenu | None[source]¶
Returns a reference to the main window “Settings” menu.
- Return type:
Optional[QMenu]
- shapeDigitizeToolBar(self) QToolBar | None[source]¶
Returns a reference to the main window “Shape Digitizing” toolbar.
- Return type:
Optional[QToolBar]
- 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]
- 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] = '')
- 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] = '')
- 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] = '')
- 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]
- 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.
- unregisterApplicationExitBlocker(self, blocker: QgsApplicationExitBlockerInterface | None)[source]¶
Unregister a previously registered application exit
blocker.See also
Added in version 3.16.
- Parameters:
blocker (Optional[QgsApplicationExitBlockerInterface])
- unregisterCustomDropHandler(self, handler: QgsCustomDropHandler | None)[source]¶
Unregister a previously registered custom drop
handler.See also
See also
- Parameters:
handler (Optional[QgsCustomDropHandler])
- unregisterCustomLayoutDropHandler(self, handler: QgsLayoutCustomDropHandler | None)[source]¶
Unregister a previously registered custom drop
handlerfor layout windows.See also
See also
- Parameters:
handler (Optional[QgsLayoutCustomDropHandler])
- 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])
- 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])
- 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
- unregisterMapLayerConfigWidgetFactory(self, factory: QgsMapLayerConfigWidgetFactory | None)[source]¶
Unregister a previously registered tab in the map layer properties dialog.
See also
- Parameters:
factory (Optional[QgsMapLayerConfigWidgetFactory])
- unregisterMapToolHandler(self, handler: QgsAbstractMapToolHandler | None)[source]¶
Unregister a previously registered map tool
handler.See also
Added in version 3.16.
- Parameters:
handler (Optional[QgsAbstractMapToolHandler])
- unregisterOptionsWidgetFactory(self, factory: QgsOptionsWidgetFactory | None)[source]¶
Unregister a previously registered tab in the options dialog.
See also
See also
- Parameters:
factory (Optional[QgsOptionsWidgetFactory])
- 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])
- userProfileManager(self) QgsUserProfileManager | None[source]¶
Returns a reference to the user profile manager
Added in version 3.30.
- Return type:
Optional[QgsUserProfileManager]
- 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
- vectorMenu(self) QMenu | None[source]¶
Returns a reference to the main window “Vector” menu.
- Return type:
Optional[QMenu]
- vectorToolBar(self) QToolBar | None[source]¶
Returns a reference to the main window “Vector” toolbar.
- Return type:
Optional[QToolBar]
- viewMenu(self) QMenu | None[source]¶
Returns a reference to the main window “View” menu.
- Return type:
Optional[QMenu]
- webMenu(self) QMenu | None[source]¶
Returns a reference to the main window “Web” menu.
- Return type:
Optional[QMenu]
- webToolBar(self) QToolBar | None[source]¶
Returns a reference to the main window “Web” toolbar.
- Return type:
Optional[QToolBar]