Class: QgisInterface¶
- class qgis.gui.QgisInterface¶
Bases:
PyQt5.QtCore.QObject
Constructor
QgisInterface Abstract base class defining interfaces exposed by
QgisApp
and made available to plugins.Only functionality exposed by
QgisInterface
can be used in plugins. This interface has to be implemented with application specific details.QGIS implements it in
QgisAppInterface
class, 3rd party applications could provide their own implementation to be able to use plugins.Methods
- rtype
QAction
Returns the native Add ArcGIS REST Server action.
- rtype
QAction
Returns the native Add ArcGIS REST Server action.
Returns the native Add Feature action.
- rtype
QAction
Returns the native Add Part action.
- rtype
QAction
Returns the native Add Point Cloud Layer action.
- rtype
QAction
Returns the native Add Ring action.
- rtype
QAction
Returns the native Add Vector Tile Layer action.
- rtype
QAction
Returns the native Add XYZ Layer action.
- rtype
QAction
- rtype
QAction
- rtype
QAction
- rtype
QAction
Returns the native add circle from 2 points action.
Returns the native add circle from 2 tangents and a point action.
Returns the native add circle from 3 points action.
Returns the native add circle from 3 tangents action.
Returns the native add circle from center action.
Returns the native Copy Features action.
- rtype
QAction
Create new print layout action
- rtype
QAction
Returns the native Cut Features action.
Returns the native Delete Part action.
Returns the native Delete Ring action.
Returns the native Delete Selected Features action.
Returns the native draw action.
- rtype
QAction
Returns the native add ellipse from center and 2 points action.
Returns the native add ellipse from center and a point action.
Returns the native add ellipse from an extent action.
Returns the native add ellipse from foci action.
Returns the Exit QGIS action.
Returns the native run action feature action.
- rtype
QAction
- rtype
QAction
Returns the Hide Deselected Layers action.
- rtype
QAction
Returns the native identify action.
- rtype
QAction
- rtype
QAction
- rtype
QAction
Returns the native map tips action.
Returns the native measure action.
Returns the native measure area action.
Returns the native Move Features action.
Returns the native new bookmark action.
Returns the native New Project action.
- rtype
QAction
- rtype
QAction
Returns the Open Project action.
Statistical summary action.
- rtype
QAction
- rtype
QAction
Returns the native pan action.
Returns the native pan to selected action.
Returns the native Paste Features action.
- rtype
QAction
- rtype
QAction
Returns the native Project Properties action.
- rtype
QAction
Returns the native add rectangle from 3 points (distance from 2nd and 3rd points) action.
Returns the native add rectangle from 3 points (distance from projected 3rd point on segment p1 and p2) action.
Returns the native add rectangle from center and a point action.
Returns the native add rectangle from extent action.
Returns the native add regular polygon from 2 points action.
Returns the native add regular polygon from center and a corner action.
Returns the native add regular polygon from center and a point action.
- rtype
QAction
- rtype
QAction
- rtype
QAction
- rtype
QAction
- rtype
QAction
- rtype
QAction
Returns the native Save Map as Image action.
Returns the native Save Project action.
Returns the native Save Project As action.
Returns the native select action.
Returns the native select freehand action.
Returns the native select polygon action.
Returns the native select radius action.
Returns the native select rectangle action.
- rtype
QAction
Returns the native show bookmarks action.
Show layout manager action
- rtype
QAction
- rtype
QAction
Returns the native Simplify/Smooth Features action.
Returns the native Split Features action.
Returns the native Split Parts action.
- rtype
QAction
- rtype
QAction
Returns the Toggle Selected Layers action.
Returns the Toggle Selected Layers Independently action.
Returns the native “Vertex Tool for All Layers” action.
Returns the native “Vertex Tool for Active Layer” action.
Returns the native zoom resolution (100%) action.
Returns the native zoom full extent action.
Returns the native zoom in action.
Returns the native zoom last action.
Returns the native zoom next action.
Returns the native zoom out action.
Returns the native zoom to layer action.
Returns the native zoom to layers action.
Returns the native zoom to selected action.
Returns a pointer to the active layer (layer selected in the legend)
Add action to context menu for a specific layer in the layer tree.
Add action to context menu for layers in the layer tree.
Add an icon to the Database toolbar
Add a widget to the database toolbar.
Adds a
dock
widget to the main window, in the specified dockarea
.Returns a reference to the main window “Add Layer” menu.
Adds a mesh layer to the current project.
Add action to the Database menu
Add action to the plugins menu
Add action to the Raster menu
Add action to the Vector menu
Add action to the Web menu
Adds a point cloud layer to the current project.
Adds (opens) a project
Adds a raster layer to the current project, given a raster layer file name.
Add an icon to the Raster toolbar
Add a widget to the raster toolbar.
Add a dock widget to the given area and tabify it (if other dock widgets exist in the same
area
).Add toolbar with specified name
Add an icon to the plugins toolbar
Add a widget to the plugins toolbar.
Adds a widget to the user input tool bar.
Adds a vector layer to the current project.
Adds a vector tile layer to the current project.
Add an icon to the Vector toolbar
Add a widget to the vector toolbar.
Add an icon to the Web toolbar
Add a widget to the web toolbar.
Add window to Window menu.
Returns a reference to the main window “Advanced Digitizing” toolbar.
Checks available datum transforms and ask user if several are available and none is chosen.
Returns a reference to the main window “Attributes” toolbar.
Returns the application browser model.
Generate stylesheet
Advanced digitizing dock widget
Closes the additional map canvas with matching
name
.Copy selected features from the layer to clipboard
Create a new map canvas with the specified unique
name
.Returns a reference to the main window “Data Source Manager” toolbar.
Returns a reference to the main window “Database” menu.
Returns a reference to the main window “Database” toolbar.
Returns a reference font for initial qApp (may not be same as
QgisApp
)Returns changeable options built from settings and/or defaults
Deregisters a locator
filter
from the app’s locator bar and deletes it.Returns a reference to the main window “Digitize” toolbar.
Returns a reference to the main window “Edit” menu.
Returns vector layers in edit mode
Returns a reference to the main window “File” toolbar.
Returns a reference to the right most standard menu, which is usually the last menu item before the “Help” menu.
Returns a feature form for a given feature.
Returns a reference to the main window “Help” menu.
Returns a reference to the main window “Help” toolbar.
Returns the toolbar icon size.
Add “add layer” action to layer menu
Invalidate results from the locator filter.
Returns a reference to the main window “Layer” menu.
Returns a reference to the main window “Layer” toolbar.
Returns a pointer to the layer tree canvas bridge
Returns the insertion point.
- rtype
QgsLayerTreeView
This will perform a search in the locator bar by setting the line edit text to
searchText
and automatically displaying any results.Returns a pointer to the main window (instance of
QgisApp
in case of QGIS)Returns a pointer to the map canvas
Returns a list of all map canvases open in the app.
Returns a reference to the main window “Map Navigation” toolbar.
Returns the action group for map tools.
Returns the message bar of the main app
Returns the timeout for timed messages: default of 5 seconds
Returns a reference to the main window “Create New Layer” menu.
Starts a new blank project.
Opens a new feature form.
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.Returns all currently open layout designers.
Opens the message log dock widget.
Open a url in the users browser.
Paste features from clipboard to the layer
Returns a reference to the main window “Plugin Help” sub-menu.
- rtype
QgsPluginManagerInterface
Returns a reference to the main window “Plugin” menu.
Returns a reference to the main window “Plugin” toolbar.
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.
Returns a reference to the main window “Project” menu.
Returns a reference to the main window “Raster” menu.
Returns a reference to the main window “Raster” toolbar.
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.
Register a new custom drop
handler
.Register a new custom drop
handler
for layout windows.Register a new custom project open
handler
.Register a new tool in the development/debugging tools dock.
Registers a locator
filter
for the app’s locator bar.Register action to the shortcuts manager so its shortcut can be changed in GUI
Register a new tab in the map layer properties dialog.
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.Register a new tab in the options dialog.
Register a new tab in the project properties dialog.
Triggered when connections have changed.
Remove “add layer” action from layer menu
Remove action for layers in the layer tree previously added with
addCustomActionForLayerType()
Remove an action (icon) from the Database toolbar
Removes the specified
dock
widget from main window (without deleting it).Remove action from the Database menu
Remove action from the plugins menu
Remove action from the Raster menu
Remove action from the Vector menu
Remove action from the Web menu
Remove an action (icon) from the Raster toolbar
Remove an action (icon) from the plugin toolbar
Remove an action (icon) from the Vector toolbar
Remove an action (icon) from the Web toolbar
Remove window from Window menu.
Save changed default option keys/values to user settings
Returns a reference to the main window “Selection” toolbar.
Set the active layer (layer gets selected in the legend) returns
True
if the layer exists,False
otherwiseSets a GPS
connection
to use within the GPS Panel widget.Returns a reference to the main window “Settings” menu.
Returns a reference to the main window “Shape Digitizing” toolbar.
Open attribute table dialog
Open layer properties dialog
Opens the layout manager dialog.
Opens the options dialog.
Opens the project properties dialog.
Returns a pointer to the app’s status bar interface.
Take screenshots for user documentation
Unregister a previously registered application exit
blocker
.Unregister a previously registered custom drop
handler
.Unregister a previously registered custom drop
handler
for layout windows.Unregister a previously registered custom project open
handler
.Unregister a previously registered tool factory from the development/debugging tools dock.
Unregister a previously registered action.
Unregister a previously registered tab in the map layer properties dialog.
Unregister a previously registered map tool
handler
.Unregister a previously registered tab in the options dialog.
Unregister a previously registered tab in the options dialog.
Access the vector layer tools instance.
Returns a reference to the main window “Vector” menu.
Returns a reference to the main window “Vector” toolbar.
Returns a reference to the main window “View” menu.
Returns a reference to the main window “Web” menu.
Returns a reference to the main window “Web” toolbar.
Returns a reference to the main window “Window” menu.
Zooms to the full extent of all map layers.
Zooms to extent of the active layer.
Zooms to the next view extent.
Zooms to the previous view extent.
Signals
Emitted whenever current (selected) layer changes.
Emitted when the current
theme
is changed so plugins can change their tool button icons.Emitted when the initialization is complete.
Emitted when a layer has been saved using save as.
Emitted after a layout designer window is closed.
Emitted when a new layout
designer
has been opened.Emitted before a layout
designer
is going to be closed and deleted.Emitted when starting an entirely new project.
Emitted when a project file is successfully read.
- actionAbout(self) → QAction¶
- Return type
QAction
- actionAddAfsLayer(self) → QAction¶
Returns the native Add ArcGIS REST Server action.
- Return type
QAction
- actionAddAllToOverview(self) → QAction¶
- Return type
QAction
- actionAddAmsLayer(self) → QAction¶
Returns the native Add ArcGIS REST Server action.
- Return type
QAction
- actionAddFeature(self) → QAction¶
Returns the native Add Feature action.
- Return type
QAction
- actionAddOgrLayer(self) → QAction¶
- Return type
QAction
- actionAddPart(self) → QAction¶
Returns the native Add Part action.
- Return type
QAction
- actionAddPgLayer(self) → QAction¶
- Return type
QAction
- actionAddPointCloudLayer(self) → QAction¶
Returns the native Add Point Cloud Layer action.
New in version 3.18.
- Return type
QAction
- actionAddRasterLayer(self) → QAction¶
- Return type
QAction
- actionAddRing(self) → QAction¶
Returns the native Add Ring action.
- Return type
QAction
- actionAddToOverview(self) → QAction¶
- Return type
QAction
- actionAddVectorTileLayer(self) → QAction¶
Returns the native Add Vector Tile Layer action.
New in version 3.14.
- Return type
QAction
- actionAddWmsLayer(self) → QAction¶
- Return type
QAction
- actionAddXyzLayer(self) → QAction¶
Returns the native Add XYZ Layer action.
New in version 3.14.
- Return type
QAction
- actionAllEdits(self) → QAction¶
- Return type
QAction
- actionCancelAllEdits(self) → QAction¶
- Return type
QAction
- actionCancelEdits(self) → QAction¶
- Return type
QAction
- actionCheckQgisVersion(self) → QAction¶
- Return type
QAction
- actionCircle2Points(self) → QAction¶
Returns the native add circle from 2 points action. Call
trigger()
on it to set the map tool.- Return type
QAction
- actionCircle2TangentsPoint(self) → QAction¶
Returns the native add circle from 2 tangents and a point action. Call
trigger()
on it to set the map tool.- Return type
QAction
- actionCircle3Points(self) → QAction¶
Returns the native add circle from 3 points action. Call
trigger()
on it to set the map tool.- Return type
QAction
- actionCircle3Tangents(self) → QAction¶
Returns the native add circle from 3 tangents action. Call
trigger()
on it to set the map tool.- Return type
QAction
- actionCircleCenterPoint(self) → QAction¶
Returns the native add circle from center action. Call
trigger()
on it to set the map tool.- Return type
QAction
- actionCopyFeatures(self) → QAction¶
Returns the native Copy Features action.
- Return type
QAction
- actionCopyLayerStyle(self) → QAction¶
- Return type
QAction
- actionCreatePrintLayout(self) → QAction¶
Create new print layout action
- Return type
QAction
- actionCustomProjection(self) → QAction¶
- Return type
QAction
- actionCutFeatures(self) → QAction¶
Returns the native Cut Features action.
- Return type
QAction
- actionDeletePart(self) → QAction¶
Returns the native Delete Part action.
- Return type
QAction
- actionDeleteRing(self) → QAction¶
Returns the native Delete Ring action.
- Return type
QAction
- actionDeleteSelected(self) → QAction¶
Returns the native Delete Selected Features action.
- Return type
QAction
- actionDraw(self) → QAction¶
Returns the native draw action.
- Return type
QAction
- actionDuplicateLayer(self) → QAction¶
- Return type
QAction
- actionEllipseCenter2Points(self) → QAction¶
Returns the native add ellipse from center and 2 points action. Call
trigger()
on it to set the map tool.- Return type
QAction
- actionEllipseCenterPoint(self) → QAction¶
Returns the native add ellipse from center and a point action. Call
trigger()
on it to set the map tool.- Return type
QAction
- actionEllipseExtent(self) → QAction¶
Returns the native add ellipse from an extent action. Call
trigger()
on it to set the map tool.- Return type
QAction
- actionEllipseFoci(self) → QAction¶
Returns the native add ellipse from foci action. Call
trigger()
on it to set the map tool.- Return type
QAction
- actionExit(self) → QAction¶
Returns the Exit QGIS action.
- Return type
QAction
- actionFeatureAction(self) → QAction¶
Returns the native run action feature action. Call
trigger()
on it to set the default run feature action map tool.- Return type
QAction
- actionHelpContents(self) → QAction¶
- Return type
QAction
- actionHideAllLayers(self) → QAction¶
- Return type
QAction
- actionHideDeselectedLayers(self) → QAction¶
Returns the Hide Deselected Layers action.
New in version 3.0.
- Return type
QAction
- actionHideSelectedLayers(self) → QAction¶
- Return type
QAction
- actionIdentify(self) → QAction¶
Returns the native identify action. Call
trigger()
on it to set the default identify map tool.- Return type
QAction
- actionLayerProperties(self) → QAction¶
- Return type
QAction
- actionLayerSaveAs(self) → QAction¶
- Return type
QAction
- actionManagePlugins(self) → QAction¶
- Return type
QAction
- actionMapTips(self) → QAction¶
Returns the native map tips action. Call
trigger()
on it to toggle map tips.- Return type
QAction
- actionMeasure(self) → QAction¶
Returns the native measure action. Call
trigger()
on it to set the default measure map tool.- Return type
QAction
- actionMeasureArea(self) → QAction¶
Returns the native measure area action. Call
trigger()
on it to set the default measure area map tool.- Return type
QAction
- actionMoveFeature(self) → QAction¶
Returns the native Move Features action.
- Return type
QAction
- actionNewBookmark(self) → QAction¶
Returns the native new bookmark action. Call
trigger()
on it to open the new bookmark dialog.- Return type
QAction
- actionNewProject(self) → QAction¶
Returns the native New Project action.
- Return type
QAction
- actionNewVectorLayer(self) → QAction¶
- Return type
QAction
- actionOpenFieldCalculator(self) → QAction¶
- Return type
QAction
- actionOpenProject(self) → QAction¶
Returns the Open Project action.
- Return type
QAction
- actionOpenStatisticalSummary(self) → QAction¶
Statistical summary action.
New in version 3.0.
- Return type
QAction
- actionOpenTable(self) → QAction¶
- Return type
QAction
- actionOptions(self) → QAction¶
- Return type
QAction
- actionPan(self) → QAction¶
Returns the native pan action. Call
trigger()
on it to set the default pan map tool.- Return type
QAction
- actionPanToSelected(self) → QAction¶
Returns the native pan to selected action. Call
trigger()
on it to pan the map canvas to the selection.- Return type
QAction
- actionPasteFeatures(self) → QAction¶
Returns the native Paste Features action.
- Return type
QAction
- actionPasteLayerStyle(self) → QAction¶
- Return type
QAction
- actionPluginListSeparator(self) → QAction¶
- Return type
QAction
- actionProjectProperties(self) → QAction¶
Returns the native Project Properties action.
- Return type
QAction
- actionQgisHomePage(self) → QAction¶
- Return type
QAction
- actionRectangle3PointsDistance(self) → QAction¶
Returns the native add rectangle from 3 points (distance from 2nd and 3rd points) action. Call
trigger()
on it to set the map tool.- Return type
QAction
- actionRectangle3PointsProjected(self) → QAction¶
Returns the native add rectangle from 3 points (distance from projected 3rd point on segment p1 and p2) action. Call
trigger()
on it to set the map tool.- Return type
QAction
- actionRectangleCenterPoint(self) → QAction¶
Returns the native add rectangle from center and a point action. Call
trigger()
on it to set the map tool.- Return type
QAction
- actionRectangleExtent(self) → QAction¶
Returns the native add rectangle from extent action. Call
trigger()
on it to set the map tool.- Return type
QAction
- actionRegularPolygon2Points(self) → QAction¶
Returns the native add regular polygon from 2 points action. Call
trigger()
on it to set the map tool.- Return type
QAction
- actionRegularPolygonCenterCorner(self) → QAction¶
Returns the native add regular polygon from center and a corner action. Call
trigger()
on it to set the map tool.- Return type
QAction
- actionRegularPolygonCenterPoint(self) → QAction¶
Returns the native add regular polygon from center and a point action. Call
trigger()
on it to set the map tool.- Return type
QAction
- actionRemoveAllFromOverview(self) → QAction¶
- Return type
QAction
- actionRollbackAllEdits(self) → QAction¶
- Return type
QAction
- actionRollbackEdits(self) → QAction¶
- Return type
QAction
- actionSaveActiveLayerEdits(self) → QAction¶
- Return type
QAction
- actionSaveAllEdits(self) → QAction¶
- Return type
QAction
- actionSaveEdits(self) → QAction¶
- Return type
QAction
- actionSaveMapAsImage(self) → QAction¶
Returns the native Save Map as Image action.
- Return type
QAction
- actionSaveProject(self) → QAction¶
Returns the native Save Project action.
- Return type
QAction
- actionSaveProjectAs(self) → QAction¶
Returns the native Save Project As action.
- Return type
QAction
- actionSelect(self) → QAction¶
Returns the native select action. Call
trigger()
on it to set the default select map tool.- Return type
QAction
- actionSelectFreehand(self) → QAction¶
Returns the native select freehand action. Call
trigger()
on it to set the default select freehand map tool.- Return type
QAction
- actionSelectPolygon(self) → QAction¶
Returns the native select polygon action. Call
trigger()
on it to set the default select polygon map tool.- Return type
QAction
- actionSelectRadius(self) → QAction¶
Returns the native select radius action. Call
trigger()
on it to set the default select radius map tool.- Return type
QAction
- actionSelectRectangle(self) → QAction¶
Returns the native select rectangle action. Call
trigger()
on it to set the default select rectangle map tool.- Return type
QAction
- actionShowAllLayers(self) → QAction¶
- Return type
QAction
- actionShowBookmarks(self) → QAction¶
Returns the native show bookmarks action. Call
trigger()
on it to open the bookmarks dialog.- Return type
QAction
- actionShowLayoutManager(self) → QAction¶
Show layout manager action
- Return type
QAction
- actionShowPythonDialog(self) → QAction¶
- Return type
QAction
- actionShowSelectedLayers(self) → QAction¶
- Return type
QAction
- actionSimplifyFeature(self) → QAction¶
Returns the native Simplify/Smooth Features action.
- Return type
QAction
- actionSplitFeatures(self) → QAction¶
Returns the native Split Features action.
- Return type
QAction
- actionSplitParts(self) → QAction¶
Returns the native Split Parts action.
- Return type
QAction
- actionToggleEditing(self) → QAction¶
- Return type
QAction
- actionToggleFullScreen(self) → QAction¶
- Return type
QAction
- actionToggleSelectedLayers(self) → QAction¶
Returns the Toggle Selected Layers action.
New in version 3.14.
- Return type
QAction
- actionToggleSelectedLayersIndependently(self) → QAction¶
Returns the Toggle Selected Layers Independently action.
New in version 3.14.
- Return type
QAction
- actionVertexTool(self) → QAction¶
Returns the native “Vertex Tool for All Layers” action.
See also
- Return type
QAction
- actionVertexToolActiveLayer(self) → QAction¶
Returns the native “Vertex Tool for Active Layer” action.
See also
New in version 3.6.
- Return type
QAction
- actionZoomActualSize(self) → QAction¶
Returns the native zoom resolution (100%) action. Call
trigger()
on it to zoom to actual size.- Return type
QAction
- actionZoomFullExtent(self) → QAction¶
Returns the native zoom full extent action. Call
trigger()
on it to zoom to the full extent.- Return type
QAction
- actionZoomIn(self) → QAction¶
Returns the native zoom in action. Call
trigger()
on it to set the default zoom in map tool.- Return type
QAction
- actionZoomLast(self) → QAction¶
Returns the native zoom last action. Call
trigger()
on it to zoom to last.- Return type
QAction
- actionZoomNext(self) → QAction¶
Returns the native zoom next action. Call
trigger()
on it to zoom to next.- Return type
QAction
- actionZoomOut(self) → QAction¶
Returns the native zoom out action. Call
trigger()
on it to set the default zoom out map tool.- Return type
QAction
- actionZoomToLayer(self) → QAction¶
Returns the native zoom to layer action. Call
trigger()
on it to zoom to the active layer.Deprecated since version Use:
actionZoomToLayers()
instead.- Return type
QAction
- actionZoomToLayers(self) → QAction¶
Returns the native zoom to layers action. Call
trigger()
on it to zoom to the selected layers.New in version 3.18.
- Return type
QAction
- actionZoomToSelected(self) → QAction¶
Returns the native zoom to selected action. Call
trigger()
on it to zoom to the current selection.- Return type
QAction
- activeLayer(self) → QgsMapLayer¶
Returns a pointer to the active layer (layer selected in the legend)
- Return type
- addCustomActionForLayer(self, action: QAction, layer: QgsMapLayer)¶
Add action to context menu for a specific layer in the layer tree. It is necessary to first call
addCustomActionForLayerType()
with allLayers=false in order for this method to have any effect.See also
- Parameters
action (QAction) –
layer (QgsMapLayer) –
- addCustomActionForLayerType(self, action: QAction, menu: str, type: QgsMapLayerType, allLayers: bool)¶
Add action to context menu for layers in the layer tree. If allLayers is
True
, then the action will be available for all layers of given type, otherwise the action will be available only for specific layers added 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 (QAction) –
menu (str) –
type (QgsMapLayerType) –
allLayers (bool) –
- addDatabaseToolBarIcon(self, qAction: QAction) → int¶
Add an icon to the Database toolbar
- Parameters
qAction (QAction) –
- Return type
int
- addDatabaseToolBarWidget(self, widget: QWidget) → QAction¶
Add a widget to the database toolbar. To remove this widget again, call
removeDatabaseToolBarIcon()
with the returned QAction.- Parameters
widget (QWidget) – widget to add. The toolbar will take ownership of this widget
- Return type
QAction
- Returns
the QAction you can use to remove this widget from the toolbar
- addDockWidget(self, area: Qt.DockWidgetArea, dockwidget: QDockWidget)¶
Adds a
dock
widget to the main window, in the specified dockarea
.See also
See also
- Parameters
area (Qt.DockWidgetArea) –
dockwidget (QDockWidget) –
- addLayerMenu(self) → QMenu¶
Returns a reference to the main window “Add Layer” menu.
New in version 2.5.
- Return type
QMenu
- addMeshLayer(self, url: str, baseName: str, providerKey: str) → QgsMeshLayer¶
Adds a mesh layer to the current project.
- Parameters
url (str) –
baseName (str) –
providerKey (str) –
- Return type
- addPluginToDatabaseMenu(self, name: str, action: QAction)¶
Add action to the Database menu
- Parameters
name (str) –
action (QAction) –
- addPluginToMenu(self, name: str, action: QAction)¶
Add action to the plugins menu
- Parameters
name (str) –
action (QAction) –
- addPluginToRasterMenu(self, name: str, action: QAction)¶
Add action to the Raster menu
- Parameters
name (str) –
action (QAction) –
- addPluginToVectorMenu(self, name: str, action: QAction)¶
Add action to the Vector menu
- Parameters
name (str) –
action (QAction) –
- addPluginToWebMenu(self, name: str, action: QAction)¶
Add action to the Web menu
- Parameters
name (str) –
action (QAction) –
- addPointCloudLayer(self, url: str, baseName: str, providerKey: str) → QgsPointCloudLayer¶
Adds a point cloud layer to the current project.
New in version 3.18.
- Parameters
url (str) –
baseName (str) –
providerKey (str) –
- Return type
- addProject(self, project: str) → bool¶
Adds (opens) a project
- Parameters
project (str) –
- Return type
bool
- addRasterLayer(self, rasterLayerPath: str, baseName: str = '') → QgsRasterLayer¶
Adds a raster layer to the current project, given a raster layer file name.
addRasterLayer(self, url: str, layerName: str, providerKey: str) -> QgsRasterLayer Adds a raster layer to the current project, from the specified raster data provider.
- Parameters
rasterLayerPath (str) –
baseName (str = '') –
- Return type
- addRasterToolBarIcon(self, qAction: QAction) → int¶
Add an icon to the Raster toolbar
- Parameters
qAction (QAction) –
- Return type
int
- addRasterToolBarWidget(self, widget: QWidget) → QAction¶
Add a widget to the raster toolbar. To remove this widget again, call
removeRasterToolBarIcon()
with the returned QAction.- Parameters
widget (QWidget) – widget to add. The toolbar will take ownership of this widget
- Return type
QAction
- Returns
the QAction you can use to remove this widget from the toolbar
- addTabifiedDockWidget(self, area: Qt.DockWidgetArea, dockwidget: QDockWidget, tabifyWith: Iterable[str] = [], raiseTab: bool = False)¶
Add a dock widget to the given area and tabify it (if other dock widgets exist in the same
area
). The new tab will be below other tabs unlessraiseTab
is passed asTrue
.tabifyWith
is a list of dock widget object names, ordered by priority, with which the new dock widget should be tabified. Only the first matching object name will be picked. If none of the given object names is found in thatarea
(or iftabifyWith
is not given at all), the new dock widget will be created anyways, but its location within thatarea
will be unpredictable.New in version 3.14.
- Parameters
area (Qt.DockWidgetArea) –
dockwidget (QDockWidget) –
tabifyWith (Iterable[str] = []) –
raiseTab (bool = False) –
- addToolBar(self, name: str) → QToolBar¶
Add toolbar with specified name
addToolBar(self, toolbar: QToolBar, area: Qt.ToolBarArea = Qt.TopToolBarArea) Add a toolbar
New in version 2.3.
- Parameters
name (str) –
- Return type
QToolBar
- addToolBarIcon(self, qAction: QAction) → int¶
Add an icon to the plugins toolbar
- Parameters
qAction (QAction) –
- Return type
int
- addToolBarWidget(self, widget: QWidget) → QAction¶
Add a widget to the plugins toolbar. To remove this widget again, call
removeToolBarIcon()
with the returned QAction.- Parameters
widget (QWidget) – widget to add. The toolbar will take ownership of this widget
- Return type
QAction
- Returns
the QAction you can use to remove this widget from the toolbar
- addUserInputWidget(self, widget: QWidget)¶
Adds a widget to the user input tool bar.
- Parameters
widget (QWidget) –
- addVectorLayer(self, vectorLayerPath: str, baseName: str, providerKey: str) → QgsVectorLayer¶
Adds a vector layer to the current project.
- Parameters
vectorLayerPath (str) –
baseName (str) –
providerKey (str) –
- Return type
- addVectorTileLayer(self, url: str, baseName: str) → QgsVectorTileLayer¶
Adds a vector tile layer to the current project.
New in version 3.14.
- Parameters
url (str) –
baseName (str) –
- Return type
- addVectorToolBarIcon(self, qAction: QAction) → int¶
Add an icon to the Vector toolbar
- Parameters
qAction (QAction) –
- Return type
int
- addVectorToolBarWidget(self, widget: QWidget) → QAction¶
Add a widget to the vector toolbar. To remove this widget again, call
removeVectorToolBarIcon()
with the returned QAction.- Parameters
widget (QWidget) – widget to add. The toolbar will take ownership of this widget
- Return type
QAction
- Returns
the QAction you can use to remove this widget from the toolbar
- addWebToolBarIcon(self, qAction: QAction) → int¶
Add an icon to the Web toolbar
- Parameters
qAction (QAction) –
- Return type
int
- addWebToolBarWidget(self, widget: QWidget) → QAction¶
Add a widget to the web toolbar. To remove this widget again, call
removeWebToolBarIcon()
with the returned QAction.- Parameters
widget (QWidget) – widget to add. The toolbar will take ownership of this widget
- Return type
QAction
- Returns
the QAction you can use to remove this widget from the toolbar
- addWindow(self, action: QAction)¶
Add window to Window menu. The action title is the window title and the action should raise, unminimize and activate the window.
- Parameters
action (QAction) –
- advancedDigitizeToolBar(self) → QToolBar¶
Returns a reference to the main window “Advanced Digitizing” toolbar.
- Return type
QToolBar
- askForDatumTransform(self, sourceCrs: QgsCoordinateReferenceSystem, destinationCrs: QgsCoordinateReferenceSystem) → bool¶
Checks available datum transforms and ask user if several are available and none is chosen. Dialog is shown only if global option is set accordingly.
- Return type
bool
- Returns
True
if a datum transform has been specifically chosen by user or only one is available.
New in version 3.0.
- Parameters
sourceCrs (QgsCoordinateReferenceSystem) –
destinationCrs (QgsCoordinateReferenceSystem) –
- attributesToolBar(self) → QToolBar¶
Returns a reference to the main window “Attributes” toolbar.
- Return type
QToolBar
- browserModel(self) → QgsBrowserGuiModel¶
Returns the application browser model. Using this shared model is more efficient than creating a new browser model for every use.
New in version 3.4.
- Return type
- buildStyleSheet(self, opts: Dict[str, Any])¶
Generate stylesheet
- Parameters
opts (Dict[str) – generated default option values, or a changed copy of them
- cadDockWidget(self) → QgsAdvancedDigitizingDockWidget¶
Advanced digitizing dock widget
New in version 2.12.
- Return type
- childEvent(self, QChildEvent)¶
- closeMapCanvas(self, name: str)¶
Closes the additional map canvas with matching
name
.See also
New in version 3.0.
- Parameters
name (str) –
- connectNotify(self, QMetaMethod)¶
- copySelectionToClipboard(self, QgsMapLayer)¶
Copy selected features from the layer to clipboard
New in version 3.0.
- createNewMapCanvas(self, name: str) → QgsMapCanvas¶
Create a new map canvas with the specified unique
name
.See also
New in version 3.0.
- Parameters
name (str) –
- Return type
- currentLayerChanged¶
Emitted whenever current (selected) layer changes. The pointer to layer can be
None
if no layer is selected. [signal]- Parameters
layer (QgsMapLayer) –
- currentThemeChanged¶
Emitted when the current
theme
is changed so plugins can change their tool button icons.New in version 3.0: [signal]
- Parameters
theme (str) –
- customEvent(self, QEvent)¶
- dataSourceManagerToolBar(self) → QToolBar¶
Returns a reference to the main window “Data Source Manager” toolbar.
New in version 3.4.
- Return type
QToolBar
- databaseMenu(self) → QMenu¶
Returns a reference to the main window “Database” menu.
- Return type
QMenu
- databaseToolBar(self) → QToolBar¶
Returns a reference to the main window “Database” toolbar.
- Return type
QToolBar
- defaultStyleSheetFont(self) → QFont¶
Returns a reference font for initial qApp (may not be same as
QgisApp
)- Return type
QFont
- defaultStyleSheetOptions(self) → Dict[str, Any]¶
Returns changeable options built from settings and/or defaults
- Return type
Dict[str, Any]
- deregisterLocatorFilter(self, filter: QgsLocatorFilter)¶
Deregisters a locator
filter
from the app’s locator bar and deletes it. Calling this will block whilst any currently running query is terminated.Plugins which register filters to the locator bar must take care to correctly call
deregisterLocatorFilter()
to deregister their filters upon plugin unload to avoid crashes.See also
New in version 3.0.
- Parameters
filter (QgsLocatorFilter) –
- digitizeToolBar(self) → QToolBar¶
Returns a reference to the main window “Digitize” toolbar.
- Return type
QToolBar
- disconnectNotify(self, QMetaMethod)¶
- editMenu(self) → QMenu¶
Returns a reference to the main window “Edit” menu.
- Return type
QMenu
- editableLayers(self, modified: bool = False) → List[QgsMapLayer]¶
Returns vector layers in edit mode
- Parameters
modified (bool = False) – whether to return only layers that have been modified
- Return type
List[QgsMapLayer]
- Returns
list of layers in legend order, or empty list
- fileToolBar(self) → QToolBar¶
Returns a reference to the main window “File” toolbar.
- Return type
QToolBar
- firstRightStandardMenu(self) → QMenu¶
Returns a reference to the right most standard menu, which is usually the last menu item before the “Help” menu.
This can be used to insert additional top-level menus into their correct position BEFORE the help menu.
- Return type
QMenu
- getFeatureForm(self, l: QgsVectorLayer, f: QgsFeature) → QgsAttributeDialog¶
Returns a feature form for a given feature.
- Parameters
l (QgsVectorLayer) – The layer for which the dialog will be created
f (QgsFeature) – The feature for which the dialog will be created
- Return type
- Returns
A feature form
- helpMenu(self) → QMenu¶
Returns a reference to the main window “Help” menu.
- Return type
QMenu
- helpToolBar(self) → QToolBar¶
Returns a reference to the main window “Help” toolbar.
- Return type
QToolBar
- iconSize(self, dockedToolbar: bool = False) → QSize¶
Returns the toolbar icon size. If
dockedToolbar
isTrue
, the icon size for toolbars contained within docks is returned.- Parameters
dockedToolbar (bool = False) –
- Return type
QSize
- initializationCompleted¶
Emitted when the initialization is complete. [signal]
- insertAddLayerAction(self, action: QAction)¶
Add “add layer” action to layer menu
- Parameters
action (QAction) –
- invalidateLocatorResults(self)¶
Invalidate results from the locator filter.
This might be useful if the configuration of the filter changed without going through main application settings.
New in version 3.2.
- isSignalConnected(self, QMetaMethod) → bool¶
- layerMenu(self) → QMenu¶
Returns a reference to the main window “Layer” menu.
- Return type
QMenu
- layerSavedAs¶
Emitted when a layer has been saved using save as.
New in version 2.7: [signal]
- Parameters
l (QgsMapLayer) –
path (str) –
- layerToolBar(self) → QToolBar¶
Returns a reference to the main window “Layer” toolbar.
- Return type
QToolBar
- layerTreeCanvasBridge(self) → QgsLayerTreeMapCanvasBridge¶
Returns a pointer to the layer tree canvas bridge
New in version 2.12.
- Return type
- layerTreeInsertionPoint(self) → QgsLayerTreeRegistryBridge.InsertionPoint¶
Returns the insertion point. This represents the current layer tree group and index where newly added map layers should be inserted into.
New in version 3.10.
- Return type
- layerTreeView(self) → QgsLayerTreeView¶
- Return type
- layoutDesignerClosed¶
Emitted after a layout designer window is closed.
See also
See also
New in version 3.0: [signal]
- layoutDesignerOpened¶
Emitted when a new layout
designer
has been opened.See also
New in version 3.0: [signal]
- Parameters
designer (QgsLayoutDesignerInterface) –
- layoutDesignerWillBeClosed¶
Emitted before a layout
designer
is going to be closed and deleted.See also
See also
New in version 3.0: [signal]
- Parameters
designer (QgsLayoutDesignerInterface) –
- locatorSearch(self, searchText: str)¶
This will perform a search in the locator bar by setting the line edit text to
searchText
and automatically displaying any results.New in version 3.10.
- Parameters
searchText (str) –
- mainWindow(self) → QWidget¶
Returns a pointer to the main window (instance of
QgisApp
in case of QGIS)- Return type
QWidget
- mapCanvas(self) → QgsMapCanvas¶
Returns a pointer to the map canvas
- Return type
- mapCanvases(self) → List[QgsMapCanvas]¶
Returns a list of all map canvases open in the app.
New in version 3.0.
- Return type
List[QgsMapCanvas]
Returns a reference to the main window “Map Navigation” toolbar.
- Return type
QToolBar
- mapToolActionGroup(self) → QActionGroup¶
Returns the action group for map tools.
Any actions added by plugins for toggling a map tool should also be added to this action group so that they behave identically to the native, in-built map tool actions.
New in version 3.16.
- Return type
QActionGroup
- messageBar(self) → QgsMessageBar¶
Returns the message bar of the main app
- Return type
- messageTimeout(self) → int¶
Returns the timeout for timed messages: default of 5 seconds
- Return type
int
- newLayerMenu(self) → QMenu¶
Returns a reference to the main window “Create New Layer” menu.
- Return type
QMenu
- newProject(self, promptToSaveFlag: bool = False) → bool¶
Starts a new blank project.
If
promptToSaveFlag
isTrue
then 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
True
if a new project was created, orFalse
if the operation was not successful (e.g. the user opted to cancel when prompted to save the current project).- Parameters
promptToSaveFlag (bool = False) –
- Return type
bool
- newProjectCreated¶
Emitted when starting an entirely new project.
Note
This is similar to
projectRead()
; plugins might want to be notified that they’re in a new project. Yes,projectRead()
could have been overloaded to be used in the case of new projects instead. However, it’s probably more semantically correct to have an entirely separate signal for when this happens. [signal]
- openFeatureForm(self, l: QgsVectorLayer, f: QgsFeature, updateFeatureOnly: bool = False, showModal: bool = True) → bool¶
Opens a new feature form. Returns
True
if dialog was accepted (if shown modal,True
otherwise).- Parameters
l (QgsVectorLayer) – vector layer
f (QgsFeature) – feature to show/modify
updateFeatureOnly (bool = False) – only update the feature update (don’t change any attributes of the layer) [UNUSED]
showModal (bool = True) – if
True
, will wait for the dialog to be executed (only shown otherwise)
- Return type
bool
- openLayoutDesigner(self, layout: QgsMasterLayoutInterface) → QgsLayoutDesignerInterface¶
Opens a new layout designer dialog for the specified
layout
, or brings an already open designer window to the foreground if one is already created for the layout.New in version 3.0.
- Parameters
layout (QgsMasterLayoutInterface) –
- Return type
- openLayoutDesigners(self) → List[QgsLayoutDesignerInterface]¶
Returns all currently open layout designers.
New in version 3.0.
- Return type
- openMessageLog(self)¶
Opens the message log dock widget.
- openURL(self, url: str, useQgisDocDirectory: bool = True)¶
Open a url in the users browser. By default the QGIS doc directory is used as the base for the URL. To open a URL that is not relative to the installed QGIS documentation, set useQgisDocDirectory to
False
.- Parameters
url (str) – URL to open
useQgisDocDirectory (bool = True) – If
True
, the URL will be formed by concatenating url to the QGIS documentation directory path (prefix/share/doc)
Deprecated since version Use: QDesktopServices instead
- pasteFromClipboard(self, QgsMapLayer)¶
Paste features from clipboard to the layer
New in version 3.0.
- pluginHelpMenu(self) → QMenu¶
Returns a reference to the main window “Plugin Help” sub-menu.
Plugins are encouraged to insert help and about actions in this submenu instead of creating a submenu under the
pluginMenu()
which solely contains Plugin Help or About actions.New in version 3.10.
- Return type
QMenu
- pluginManagerInterface(self) → QgsPluginManagerInterface¶
- Return type
- pluginMenu(self) → QMenu¶
Returns a reference to the main window “Plugin” menu.
- Return type
QMenu
- pluginToolBar(self) → QToolBar¶
Returns a reference to the main window “Plugin” toolbar.
- Return type
QToolBar
- preloadForm(self, uifile: str)¶
This method is only needed when using a UI form with a custom widget plugin and calling openFeatureForm or getFeatureForm from Python (PyQt) and you haven’t used the info tool first. Python will crash bringing QGIS with it if the custom form is not loaded from a C++ method call.
This method uses a QTimer to call QUiLoader in order to load the form via C++. You only need to call this once. After that you can call openFeatureForm/getFeatureForm like usual.
More information here: http://qt-project.org/forums/viewthread/27098
- Parameters
uifile (str) –
- projectMenu(self) → QMenu¶
Returns a reference to the main window “Project” menu.
- Return type
QMenu
- projectRead¶
Emitted when a project file is successfully read.
Note
This is useful for plugins that store properties with project files. A plugin can connect to this signal. When it is emitted the plugin knows to then check the project properties for any relevant state. [signal]
- rasterMenu(self) → QMenu¶
Returns a reference to the main window “Raster” menu.
- Return type
QMenu
- rasterToolBar(self) → QToolBar¶
Returns a reference to the main window “Raster” toolbar.
- Return type
QToolBar
- receivers(self, PYQT_SIGNAL) → int¶
- registerApplicationExitBlocker(self, blocker: QgsApplicationExitBlockerInterface)¶
Register a new application exit blocker, which can be used to prevent the QGIS application from exiting while a plugin or script has unsaved changes.
Note
Ownership of
blocker
is not transferred, and the blocker must be unregistered when plugin is unloaded.See also
New in version 3.16.
- Parameters
blocker (QgsApplicationExitBlockerInterface) –
- registerCustomDropHandler(self, handler: QgsCustomDropHandler)¶
Register a new custom drop
handler
.Note
Ownership of
handler
is not transferred, and the handler must be unregistered when plugin is unloaded.See also
See also
New in version 3.0.
- Parameters
handler (QgsCustomDropHandler) –
- registerCustomLayoutDropHandler(self, handler: QgsLayoutCustomDropHandler)¶
Register a new custom drop
handler
for layout windows.Note
Ownership of
handler
is not transferred, and the handler must be unregistered when plugin is unloaded.See also
See also
New in version 3.0.
- Parameters
handler (QgsLayoutCustomDropHandler) –
- registerCustomProjectOpenHandler(self, handler: QgsCustomProjectOpenHandler)¶
Register a new custom project open
handler
.Note
Ownership of
handler
is not transferred, and the handler must be unregistered when plugin is unloaded.See also
See also
New in version 3.14.
- Parameters
handler (QgsCustomProjectOpenHandler) –
- registerDevToolWidgetFactory(self, factory: QgsDevToolWidgetFactory)¶
Register a new tool in the development/debugging tools dock.
Note
Ownership of the factory is not transferred, and the factory must be unregistered when plugin is unloaded.
See also
New in version 3.14.
- Parameters
factory (QgsDevToolWidgetFactory) –
- registerLocatorFilter(self, filter: QgsLocatorFilter)¶
Registers a locator
filter
for the app’s locator bar. Ownership of the filter is transferred to the locator.Warning
Plugins which register filters to the locator bar must take care to correctly call
deregisterLocatorFilter()
and deregister their filters upon plugin unload to avoid crashes.See also
New in version 3.0.
- Parameters
filter (QgsLocatorFilter) –
- registerMainWindowAction(self, action: QAction, defaultShortcut: str) → bool¶
Register action to the shortcuts manager so its shortcut can be changed in GUI
- Parameters
action (QAction) –
defaultShortcut (str) –
- Return type
bool
- registerMapLayerConfigWidgetFactory(self, factory: QgsMapLayerConfigWidgetFactory)¶
Register a new tab in the map layer properties dialog.
Note
Ownership of the factory is not transferred, and the factory must be unregistered when plugin is unloaded.
See also
New in version 2.16.
- Parameters
factory (QgsMapLayerConfigWidgetFactory) –
- registerMapToolHandler(self, handler: QgsAbstractMapToolHandler)¶
Register a new application map tool
handler
, which can be used to automatically setup all connections and logic required to switch to a custom map tool whenever the state of the QGIS application permits.Note
Ownership of
handler
is not transferred, and the handler must be unregistered when plugin is unloaded.See also
See also
New in version 3.16.
- Parameters
handler (QgsAbstractMapToolHandler) –
- registerOptionsWidgetFactory(self, factory: QgsOptionsWidgetFactory)¶
Register a new tab in the options dialog.
Note
Ownership of the factory is not transferred, and the factory must be unregistered when plugin is unloaded.
See also
See also
New in version 3.0.
- Parameters
factory (QgsOptionsWidgetFactory) –
- registerProjectPropertiesWidgetFactory(self, factory: QgsOptionsWidgetFactory)¶
Register a new tab in the project properties dialog.
Note
Ownership of the factory is not transferred, and the factory must be unregistered when plugin is unloaded.
See also
New in version 3.16.
- Parameters
factory (QgsOptionsWidgetFactory) –
- reloadConnections(self)¶
Triggered when connections have changed. This calls reloadConnections in the main application and triggers a signal that is forwarded to the GUI elements that needs to be updated (i.e. the source select dialogs and the browser widgets)
New in version 3.0.
- removeAddLayerAction(self, action: QAction)¶
Remove “add layer” action from layer menu
- Parameters
action (QAction) –
- removeCustomActionForLayerType(self, action: QAction) → bool¶
Remove action for layers in the layer tree previously added with
addCustomActionForLayerType()
See also
- Parameters
action (QAction) –
- Return type
bool
- removeDatabaseToolBarIcon(self, qAction: QAction)¶
Remove an action (icon) from the Database toolbar
- Parameters
qAction (QAction) –
- removeDockWidget(self, dockwidget: QDockWidget)¶
Removes the specified
dock
widget from main window (without deleting it).See also
- Parameters
dockwidget (QDockWidget) –
- removePluginDatabaseMenu(self, name: str, action: QAction)¶
Remove action from the Database menu
- Parameters
name (str) –
action (QAction) –
- removePluginMenu(self, name: str, action: QAction)¶
Remove action from the plugins menu
- Parameters
name (str) –
action (QAction) –
- removePluginRasterMenu(self, name: str, action: QAction)¶
Remove action from the Raster menu
- Parameters
name (str) –
action (QAction) –
- removePluginVectorMenu(self, name: str, action: QAction)¶
Remove action from the Vector menu
- Parameters
name (str) –
action (QAction) –
- removePluginWebMenu(self, name: str, action: QAction)¶
Remove action from the Web menu
- Parameters
name (str) –
action (QAction) –
- removeRasterToolBarIcon(self, qAction: QAction)¶
Remove an action (icon) from the Raster toolbar
- Parameters
qAction (QAction) –
- removeToolBarIcon(self, qAction: QAction)¶
Remove an action (icon) from the plugin toolbar
- Parameters
qAction (QAction) –
- removeVectorToolBarIcon(self, qAction: QAction)¶
Remove an action (icon) from the Vector toolbar
- Parameters
qAction (QAction) –
- removeWebToolBarIcon(self, qAction: QAction)¶
Remove an action (icon) from the Web toolbar
- Parameters
qAction (QAction) –
- removeWindow(self, action: QAction)¶
Remove window from Window menu. Calling this is necessary only for windows which are hidden rather than deleted when closed.
- Parameters
action (QAction) –
- saveStyleSheetOptions(self, opts: Dict[str, Any])¶
Save changed default option keys/values to user settings
- Parameters
opts (Dict[str) –
- selectionToolBar(self) → QToolBar¶
Returns a reference to the main window “Selection” toolbar.
New in version 3.14.
- Return type
QToolBar
- sender(self) → QObject¶
- senderSignalIndex(self) → int¶
- setActiveLayer(self, QgsMapLayer) → bool¶
Set the active layer (layer gets selected in the legend) returns
True
if the layer exists,False
otherwise- Return type
bool
- setGpsPanelConnection(self, connection: QgsGpsConnection)¶
Sets a GPS
connection
to use within the GPS Panel widget.Any existing GPS connection used by the widget will be disconnect and replaced with this connection. The connection is automatically registered within the
QgsApplication.gpsConnectionRegistry()
.New in version 3.16.
- Parameters
connection (QgsGpsConnection) –
- settingsMenu(self) → QMenu¶
Returns a reference to the main window “Settings” menu.
- Return type
QMenu
- shapeDigitizeToolBar(self) → QToolBar¶
Returns a reference to the main window “Shape Digitizing” toolbar.
New in version 3.0.
- Return type
QToolBar
- showAttributeTable(self, l: QgsVectorLayer, filterExpression: str = '') → QDialog¶
Open attribute table dialog
- Parameters
l (QgsVectorLayer) –
filterExpression (str = '') –
- Return type
QDialog
- showLayerProperties(self, l: QgsMapLayer)¶
Open layer properties dialog
- Parameters
l (QgsMapLayer) –
- showLayoutManager(self)¶
Opens the layout manager dialog.
New in version 3.0.
- showOptionsDialog(self, parent: QWidget = None, currentPage: str = '')¶
Opens the options dialog. The
currentPage
argument can be used to force the dialog to open at a specific page.New in version 3.0.
- Parameters
parent (QWidget = None) –
currentPage (str = '') –
- showProjectPropertiesDialog(self, currentPage: str = '')¶
Opens the project properties dialog. The
currentPage
argument can be used to force the dialog to open at a specific page.New in version 3.16.
- Parameters
currentPage (str = '') –
- statusBarIface(self) → QgsStatusBar¶
Returns a pointer to the app’s status bar interface. This should be used for interacting and adding widgets and messages to the app’s status bar (do not use the native Qt
statusBar()
method).New in version 3.0.
- Return type
- takeAppScreenShots(self, saveDirectory: str, categories: int = 0)¶
Take screenshots for user documentation
- Parameters
saveDirectory (str) – path where the screenshots will be saved
categories (int = 0) – an int as a flag value of
QgsAppScreenShots
.Categories
New in version 3.4.
- timerEvent(self, QTimerEvent)¶
- unregisterApplicationExitBlocker(self, blocker: QgsApplicationExitBlockerInterface)¶
Unregister a previously registered application exit
blocker
.See also
New in version 3.16.
- Parameters
blocker (QgsApplicationExitBlockerInterface) –
- unregisterCustomDropHandler(self, handler: QgsCustomDropHandler)¶
Unregister a previously registered custom drop
handler
.See also
See also
New in version 3.0.
- Parameters
handler (QgsCustomDropHandler) –
- unregisterCustomLayoutDropHandler(self, handler: QgsLayoutCustomDropHandler)¶
Unregister a previously registered custom drop
handler
for layout windows.See also
See also
New in version 3.0.
- Parameters
handler (QgsLayoutCustomDropHandler) –
- unregisterCustomProjectOpenHandler(self, handler: QgsCustomProjectOpenHandler)¶
Unregister a previously registered custom project open
handler
.See also
See also
New in version 3.14.
- Parameters
handler (QgsCustomProjectOpenHandler) –
- unregisterDevToolWidgetFactory(self, factory: QgsDevToolWidgetFactory)¶
Unregister a previously registered tool factory from the development/debugging tools dock.
See also
New in version 3.14.
- Parameters
factory (QgsDevToolWidgetFactory) –
- unregisterMainWindowAction(self, action: QAction) → bool¶
Unregister a previously registered action. (e.g. when plugin is going to be unloaded)
- Parameters
action (QAction) –
- Return type
bool
- unregisterMapLayerConfigWidgetFactory(self, factory: QgsMapLayerConfigWidgetFactory)¶
Unregister a previously registered tab in the map layer properties dialog.
See also
New in version 2.16.
- Parameters
factory (QgsMapLayerConfigWidgetFactory) –
- unregisterMapToolHandler(self, handler: QgsAbstractMapToolHandler)¶
Unregister a previously registered map tool
handler
.See also
New in version 3.16.
- Parameters
handler (QgsAbstractMapToolHandler) –
- unregisterOptionsWidgetFactory(self, factory: QgsOptionsWidgetFactory)¶
Unregister a previously registered tab in the options dialog.
See also
See also
New in version 3.0.
- Parameters
factory (QgsOptionsWidgetFactory) –
- unregisterProjectPropertiesWidgetFactory(self, factory: QgsOptionsWidgetFactory)¶
Unregister a previously registered tab in the options dialog.
See also
New in version 3.16.
- Parameters
factory (QgsOptionsWidgetFactory) –
- vectorLayerTools(self) → QgsVectorLayerTools¶
Access the vector layer tools instance. With the help of this you can access methods like addFeature, startEditing or stopEditing while giving the user the appropriate dialogs.
- Return type
- Returns
An instance of the vector layer tools
- vectorMenu(self) → QMenu¶
Returns a reference to the main window “Vector” menu.
- Return type
QMenu
- vectorToolBar(self) → QToolBar¶
Returns a reference to the main window “Vector” toolbar.
- Return type
QToolBar
- viewMenu(self) → QMenu¶
Returns a reference to the main window “View” menu.
- Return type
QMenu
- webMenu(self) → QMenu¶
Returns a reference to the main window “Web” menu.
- Return type
QMenu
- webToolBar(self) → QToolBar¶
Returns a reference to the main window “Web” toolbar.
- Return type
QToolBar
- windowMenu(self) → QMenu¶
Returns a reference to the main window “Window” menu.
- Return type
QMenu
- zoomFull(self)¶
Zooms to the full extent of all map layers.
- zoomToActiveLayer(self)¶
Zooms to extent of the active layer.
- zoomToNext(self)¶
Zooms to the next view extent.
- zoomToPrevious(self)¶
Zooms to the previous view extent.