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.
Enums
Methods
Returns the native Add ArcGIS FeatureServer action.
Returns the native Add ArcGIS MapServer action.
Returns the native Add Feature action.
Returns the native Add Part action.
Returns the native Add Ring action.
Returns the native Copy Features action.
Create new print layout action
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.
Returns the Exit QGIS action.
Returns the native run action feature action.
Returns the Hide Deselected Layers action.
Returns the native identify action.
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.
Returns the Open Project action.
Statistical summary action.
Returns the native pan action.
Returns the native pan to selected action.
Returns the native Paste Features action.
Returns the native Project Properties action.
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.
Returns the native show bookmarks action.
Show layout manager action
Returns the native Simplify/Smooth Features action.
Returns the native Split Features action.
Returns the native Split Parts 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 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 (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 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.
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 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 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” 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 custom drop handler.
Register a new custom drop
handler
for layout windows.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 vector layer properties dialog.
Register a new tab in the options 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
Set the active layer (layer gets selected in the legend) returns
True
if the layer exists,False
otherwiseReturns 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.
Returns a pointer to the app’s status bar interface.
Take screenshots for user documentation
Unregister a previously registered custom drop handler.
Unregister a previously registered custom drop
handler
for layout windows.Unregister a previously registered action.
Unregister a previously registered tab in the vector layer properties 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.
Attributes
-
actionAbout
(self) → QAction¶
-
actionAddAfsLayer
(self) → QAction¶ Returns the native Add ArcGIS FeatureServer action.
-
actionAddAllToOverview
(self) → QAction¶
-
actionAddAmsLayer
(self) → QAction¶ Returns the native Add ArcGIS MapServer action.
-
actionAddFeature
(self) → QAction¶ Returns the native Add Feature action.
-
actionAddOgrLayer
(self) → QAction¶
-
actionAddPart
(self) → QAction¶ Returns the native Add Part action.
-
actionAddPgLayer
(self) → QAction¶
-
actionAddRasterLayer
(self) → QAction¶
-
actionAddRing
(self) → QAction¶ Returns the native Add Ring action.
-
actionAddToOverview
(self) → QAction¶
-
actionAddWmsLayer
(self) → QAction¶
-
actionAllEdits
(self) → QAction¶
-
actionCancelAllEdits
(self) → QAction¶
-
actionCancelEdits
(self) → QAction¶
-
actionCheckQgisVersion
(self) → QAction¶
-
actionCopyFeatures
(self) → QAction¶ Returns the native Copy Features action.
-
actionCopyLayerStyle
(self) → QAction¶
-
actionCreatePrintLayout
(self) → QAction¶ Create new print layout action
-
actionCustomProjection
(self) → QAction¶
-
actionCutFeatures
(self) → QAction¶ Returns the native Cut Features action.
-
actionDeletePart
(self) → QAction¶ Returns the native Delete Part action.
-
actionDeleteRing
(self) → QAction¶ Returns the native Delete Ring action.
-
actionDeleteSelected
(self) → QAction¶ Returns the native Delete Selected Features action.
-
actionDraw
(self) → QAction¶ Returns the native draw action.
-
actionDuplicateLayer
(self) → QAction¶
-
actionExit
(self) → QAction¶ Returns the Exit QGIS action.
-
actionFeatureAction
(self) → QAction¶ Returns the native run action feature action. Call trigger() on it to set the default run feature action map tool.
-
actionHelpContents
(self) → QAction¶
-
actionHideAllLayers
(self) → QAction¶
-
actionHideDeselectedLayers
(self) → QAction¶ Returns the Hide Deselected Layers action.
New in version 3.0.
-
actionHideSelectedLayers
(self) → QAction¶
-
actionIdentify
(self) → QAction¶ Returns the native identify action. Call trigger() on it to set the default identify map tool.
-
actionLayerProperties
(self) → QAction¶
-
actionLayerSaveAs
(self) → QAction¶
-
actionManagePlugins
(self) → QAction¶
-
actionMapTips
(self) → QAction¶ Returns the native map tips action. Call trigger() on it to toggle map tips.
-
actionMeasure
(self) → QAction¶ Returns the native measure action. Call trigger() on it to set the default measure map tool.
-
actionMeasureArea
(self) → QAction¶ Returns the native measure area action. Call trigger() on it to set the default measure area map tool.
-
actionMoveFeature
(self) → QAction¶ Returns the native Move Features action.
-
actionNewBookmark
(self) → QAction¶ Returns the native new bookmark action. Call trigger() on it to open the new bookmark dialog.
-
actionNewProject
(self) → QAction¶ Returns the native New Project action.
-
actionNewVectorLayer
(self) → QAction¶
-
actionOpenFieldCalculator
(self) → QAction¶
-
actionOpenProject
(self) → QAction¶ Returns the Open Project action.
-
actionOpenStatisticalSummary
(self) → QAction¶ Statistical summary action.
New in version 3.0.
-
actionOpenTable
(self) → QAction¶
-
actionOptions
(self) → QAction¶
-
actionPan
(self) → QAction¶ Returns the native pan action. Call trigger() on it to set the default pan map tool.
-
actionPanToSelected
(self) → QAction¶ Returns the native pan to selected action. Call trigger() on it to pan the map canvas to the selection.
-
actionPasteFeatures
(self) → QAction¶ Returns the native Paste Features action.
-
actionPasteLayerStyle
(self) → QAction¶
-
actionPluginListSeparator
(self) → QAction¶
-
actionProjectProperties
(self) → QAction¶ Returns the native Project Properties action.
-
actionQgisHomePage
(self) → QAction¶
-
actionRemoveAllFromOverview
(self) → QAction¶
-
actionRollbackAllEdits
(self) → QAction¶
-
actionRollbackEdits
(self) → QAction¶
-
actionSaveActiveLayerEdits
(self) → QAction¶
-
actionSaveAllEdits
(self) → QAction¶
-
actionSaveEdits
(self) → QAction¶
-
actionSaveMapAsImage
(self) → QAction¶ Returns the native Save Map as Image action.
-
actionSaveProject
(self) → QAction¶ Returns the native Save Project action.
-
actionSaveProjectAs
(self) → QAction¶ Returns the native Save Project As action.
-
actionSelect
(self) → QAction¶ Returns the native select action. Call trigger() on it to set the default select map tool.
-
actionSelectFreehand
(self) → QAction¶ Returns the native select freehand action. Call trigger() on it to set the default select freehand map tool.
-
actionSelectPolygon
(self) → QAction¶ Returns the native select polygon action. Call trigger() on it to set the default select polygon map tool.
-
actionSelectRadius
(self) → QAction¶ Returns the native select radius action. Call trigger() on it to set the default select radius map tool.
-
actionSelectRectangle
(self) → QAction¶ Returns the native select rectangle action. Call trigger() on it to set the default select rectangle map tool.
-
actionShowAllLayers
(self) → QAction¶
-
actionShowBookmarks
(self) → QAction¶ Returns the native show bookmarks action. Call trigger() on it to open the bookmarks dialog.
-
actionShowLayoutManager
(self) → QAction¶ Show layout manager action
-
actionShowPythonDialog
(self) → QAction¶
-
actionShowSelectedLayers
(self) → QAction¶
-
actionSimplifyFeature
(self) → QAction¶ Returns the native Simplify/Smooth Features action.
-
actionSplitFeatures
(self) → QAction¶ Returns the native Split Features action.
-
actionSplitParts
(self) → QAction¶ Returns the native Split Parts action.
-
actionToggleEditing
(self) → QAction¶
-
actionToggleFullScreen
(self) → QAction¶
-
actionVertexTool
(self) → QAction¶ Returns the native “Vertex Tool for All Layers” action.
See also
-
actionVertexToolActiveLayer
(self) → QAction¶ Returns the native “Vertex Tool for Active Layer” action.
See also
New in version 3.6.
-
actionZoomActualSize
(self) → QAction¶ Returns the native zoom resolution (100%) action. Call trigger() on it to zoom to actual size.
-
actionZoomFullExtent
(self) → QAction¶ Returns the native zoom full extent action. Call trigger() on it to zoom to the full extent.
-
actionZoomIn
(self) → QAction¶ Returns the native zoom in action. Call trigger() on it to set the default zoom in map tool.
-
actionZoomLast
(self) → QAction¶ Returns the native zoom last action. Call trigger() on it to zoom to last.
-
actionZoomNext
(self) → QAction¶ Returns the native zoom next action. Call trigger() on it to zoom to next.
-
actionZoomOut
(self) → QAction¶ Returns the native zoom out action. Call trigger() on it to set the default zoom out map tool.
-
actionZoomToLayer
(self) → QAction¶ Returns the native zoom to layer action. Call trigger() on it to zoom to the active layer.
-
actionZoomToSelected
(self) → QAction¶ Returns the native zoom to selected action. Call trigger() on it to zoom to the current selection.
-
activeLayer
(self) → QgsMapLayer¶ Returns a pointer to the active layer (layer selected in the legend)
-
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
-
addCustomActionForLayerType
(self, action: QAction, menu: str, type: QgsMapLayerType, allLayers: bool)¶ Add action to context menu for layers in the layer tree. If allLayers is
True
, then the action will be available for all layers of given type, otherwise the action will be available only for specific layers added with addCustomActionForLayer() after this call.If menu argument is not empty, the action will be also added to a menu within the main window, creating menu with the given name if it does not exist yet.
See also
See also
-
addDatabaseToolBarIcon
(self, qAction: QAction) → int¶ Add an icon to the Database toolbar
-
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 – widget to add. The toolbar will take ownership of this widget
- 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
-
addLayerMenu
(self) → QMenu¶ Returns a reference to the main window “Add Layer” menu.
New in version 2.5.
-
addMeshLayer
(self, url: str, baseName: str, providerKey: str) → QgsMeshLayer¶ Adds a mesh layer to the current project.
-
addPluginToDatabaseMenu
(self, name: str, action: QAction)¶ Add action to the Database menu
-
addPluginToMenu
(self, name: str, action: QAction)¶ Add action to the plugins menu
-
addPluginToRasterMenu
(self, name: str, action: QAction)¶ Add action to the Raster menu
-
addPluginToVectorMenu
(self, name: str, action: QAction)¶ Add action to the Vector menu
-
addPluginToWebMenu
(self, name: str, action: QAction)¶ Add action to the Web menu
-
addProject
(self, project: str) → bool¶ Adds (opens) a project
-
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.
-
addRasterToolBarIcon
(self, qAction: QAction) → int¶ Add an icon to the Raster toolbar
-
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 – widget to add. The toolbar will take ownership of this widget
- Returns
the QAction you can use to remove this widget from the toolbar
-
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.
-
addToolBarIcon
(self, qAction: QAction) → int¶ Add an icon to the plugins toolbar
-
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 – widget to add. The toolbar will take ownership of this widget
- 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.
-
addVectorLayer
(self, vectorLayerPath: str, baseName: str, providerKey: str) → QgsVectorLayer¶ Adds a vector layer to the current project.
-
addVectorToolBarIcon
(self, qAction: QAction) → int¶ Add an icon to the Vector toolbar
-
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 – widget to add. The toolbar will take ownership of this widget
- 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
-
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 – widget to add. The toolbar will take ownership of this widget
- 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.
-
advancedDigitizeToolBar
(self) → QToolBar¶ Returns a reference to the main window “Advanced Digitizing” toolbar.
-
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.
- Returns
True
if a datum transform has been specifically chosen by user or only one is available.
New in version 3.0.
-
attributesToolBar
(self) → QToolBar¶ Returns a reference to the main window “Attributes” toolbar.
-
browserModel
(self) → QgsBrowserModel¶ 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.
-
buildStyleSheet
(self, opts: Dict[str, Any])¶ Generate stylesheet
- Parameters
opts – generated default option values, or a changed copy of them
-
cadDockWidget
(self) → QgsAdvancedDigitizingDockWidget¶ Advanced digitizing dock widget
New in version 2.12.
-
childEvent
()¶
-
closeMapCanvas
(self, name: str)¶ Closes the additional map canvas with matching
name
.See also
New in version 3.0.
-
connectNotify
()¶
-
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.
-
currentLayerChanged
¶ Emitted whenever current (selected) layer changes. The pointer to layer can be
None
if no layer is selected. [signal]
-
currentThemeChanged
¶ Emitted when the current
theme
is changed so plugins can change their tool button icons.New in version 3.0: [signal]
-
customEvent
()¶
-
dataSourceManagerToolBar
(self) → QToolBar¶ Returns a reference to the main window “Data Source Manager” toolbar.
New in version 3.4.
-
databaseMenu
(self) → QMenu¶ Returns a reference to the main window “Database” menu.
-
databaseToolBar
(self) → QToolBar¶ Returns a reference to the main window “Database” toolbar.
-
defaultStyleSheetFont
(self) → QFont¶ Returns a reference font for initial qApp (may not be same as QgisApp)
-
defaultStyleSheetOptions
(self) → Dict[str, Any]¶ Returns changeable options built from settings and/or defaults
-
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.
-
digitizeToolBar
(self) → QToolBar¶ Returns a reference to the main window “Digitize” toolbar.
-
disconnectNotify
()¶
-
editMenu
(self) → QMenu¶ Returns a reference to the main window “Edit” menu.
-
editableLayers
(self, modified: bool = False) → List[QgsMapLayer]¶ Returns vector layers in edit mode
- Parameters
modified – whether to return only layers that have been modified
- Returns
list of layers in legend order, or empty list
-
fileToolBar
(self) → QToolBar¶ Returns a reference to the main window “File” toolbar.
-
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.
-
getFeatureForm
(self, l: QgsVectorLayer, f: QgsFeature) → QgsAttributeDialog¶ Returns a feature form for a given feature.
- Parameters
l – The layer for which the dialog will be created
f – The feature for which the dialog will be created
- Returns
A feature form
-
helpMenu
(self) → QMenu¶ Returns a reference to the main window “Help” menu.
-
helpToolBar
(self) → QToolBar¶ Returns a reference to the main window “Help” toolbar.
-
iconSize
(self, dockedToolbar: bool = False) → QSize¶ Returns the toolbar icon size. If
dockedToolbar
isTrue
, the icon size for toolbars contained within docks is returned.
-
initializationCompleted
¶ Emitted when the initialization is complete. [signal]
-
insertAddLayerAction
(self, action: QAction)¶ Add “add layer” action to layer menu
-
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
()¶
-
layerMenu
(self) → QMenu¶ Returns a reference to the main window “Layer” menu.
-
layerSavedAs
¶ Emitted when a layer has been saved using save as.
New in version 2.7: [signal]
-
layerToolBar
(self) → QToolBar¶ Returns a reference to the main window “Layer” toolbar.
-
layerTreeCanvasBridge
(self) → QgsLayerTreeMapCanvasBridge¶ Returns a pointer to the layer tree canvas bridge
New in version 2.12.
-
layerTreeView
(self) → QgsLayerTreeView¶
-
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]
-
layoutDesignerWillBeClosed
¶ Emitted before a layout
designer
is going to be closed and deleted.See also
See also
New in version 3.0: [signal]
-
mainWindow
(self) → QWidget¶ Returns a pointer to the main window (instance of QgisApp in case of QGIS)
-
mapCanvas
(self) → QgsMapCanvas¶ Returns a pointer to the map canvas
-
mapCanvases
(self) → List[QgsMapCanvas]¶ Returns a list of all map canvases open in the app.
New in version 3.0.
Returns a reference to the main window “Map Navigation” toolbar.
-
messageBar
(self) → QgsMessageBar¶ Returns the message bar of the main app
-
messageTimeout
(self) → int¶ Returns the timeout for timed messages: default of 5 seconds
-
newLayerMenu
(self) → QMenu¶ Returns a reference to the main window “Create New Layer” menu.
-
newProject
(self, promptToSaveFlag: bool = False)¶ Starts a new blank project
-
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 – vector layer
f – feature to show/modify
updateFeatureOnly – only update the feature update (don’t change any attributes of the layer) [UNUSED]
showModal – if
True
, will wait for the dialog to be executed (only shown otherwise)
-
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.
-
openLayoutDesigners
(self) → List[QgsLayoutDesignerInterface]¶ Returns all currently open layout designers.
New in version 3.0.
-
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 – URL to open
useQgisDocDirectory – 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.
-
pluginManagerInterface
(self) → QgsPluginManagerInterface¶
-
pluginMenu
(self) → QMenu¶ Returns a reference to the main window “Plugin” menu.
-
pluginToolBar
(self) → QToolBar¶ Returns a reference to the main window “Plugin” toolbar.
-
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
-
projectMenu
(self) → QMenu¶ Returns a reference to the main window “Project” menu.
-
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.
-
rasterToolBar
(self) → QToolBar¶ Returns a reference to the main window “Raster” toolbar.
-
receivers
()¶
-
registerCustomDropHandler
(self, handler: QgsCustomDropHandler)¶ Register a new custom drop handler.
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.
-
registerCustomLayoutDropHandler
(self, handler: QgsLayoutCustomDropHandler)¶ Register a new custom drop
handler
for layout windows.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.
-
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.
-
registerMainWindowAction
(self, action: QAction, defaultShortcut: str) → bool¶ Register action to the shortcuts manager so its shortcut can be changed in GUI
-
registerMapLayerConfigWidgetFactory
(self, factory: QgsMapLayerConfigWidgetFactory)¶ Register a new tab in the vector 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.
-
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.
-
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
-
removeCustomActionForLayerType
(self, action: QAction) → bool¶ Remove action for layers in the layer tree previously added with addCustomActionForLayerType()
See also
-
removeDatabaseToolBarIcon
(self, qAction: QAction)¶ Remove an action (icon) from the Database toolbar
-
removeDockWidget
(self, dockwidget: QDockWidget)¶ Removes the specified
dock
widget from main window (without deleting it).See also
-
removePluginDatabaseMenu
(self, name: str, action: QAction)¶ Remove action from the Database menu
-
removePluginMenu
(self, name: str, action: QAction)¶ Remove action from the plugins menu
-
removePluginRasterMenu
(self, name: str, action: QAction)¶ Remove action from the Raster menu
-
removePluginVectorMenu
(self, name: str, action: QAction)¶ Remove action from the Vector menu
-
removePluginWebMenu
(self, name: str, action: QAction)¶ Remove action from the Web menu
-
removeRasterToolBarIcon
(self, qAction: QAction)¶ Remove an action (icon) from the Raster toolbar
-
removeToolBarIcon
(self, qAction: QAction)¶ Remove an action (icon) from the plugin toolbar
-
removeVectorToolBarIcon
(self, qAction: QAction)¶ Remove an action (icon) from the Vector toolbar
-
removeWebToolBarIcon
(self, qAction: QAction)¶ Remove an action (icon) from the Web toolbar
-
removeWindow
(self, action: QAction)¶ Remove window from Window menu. Calling this is necessary only for windows which are hidden rather than deleted when closed.
-
saveStyleSheetOptions
(self, opts: Dict[str, Any])¶ Save changed default option keys/values to user settings
-
sender
()¶
-
senderSignalIndex
()¶
-
setActiveLayer
(self, QgsMapLayer) → bool¶ Set the active layer (layer gets selected in the legend) returns
True
if the layer exists,False
otherwise
-
settingsMenu
(self) → QMenu¶ Returns a reference to the main window “Settings” menu.
-
shapeDigitizeToolBar
(self) → QToolBar¶ Returns a reference to the main window “Shape Digitizing” toolbar.
New in version 3.0.
-
showAttributeTable
(self, l: QgsVectorLayer, filterExpression: str = '') → QDialog¶ Open attribute table dialog
-
showLayerProperties
(self, l: QgsMapLayer)¶ Open layer properties dialog
-
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.
-
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.
-
takeAppScreenShots
(self, saveDirectory: str, categories: int = 0)¶ Take screenshots for user documentation
- Parameters
saveDirectory – path where the screenshots will be saved
categories – an int as a flag value of QgsAppScreenShots.Categories
New in version 3.4.
-
timerEvent
()¶
-
unregisterCustomDropHandler
(self, handler: QgsCustomDropHandler)¶ Unregister a previously registered custom drop handler.
See also
See also
New in version 3.0.
-
unregisterCustomLayoutDropHandler
(self, handler: QgsLayoutCustomDropHandler)¶ Unregister a previously registered custom drop
handler
for layout windows.See also
See also
New in version 3.0.
-
unregisterMainWindowAction
(self, action: QAction) → bool¶ Unregister a previously registered action. (e.g. when plugin is going to be unloaded)
-
unregisterMapLayerConfigWidgetFactory
(self, factory: QgsMapLayerConfigWidgetFactory)¶ Unregister a previously registered tab in the vector layer properties dialog.
See also
New in version 2.16.
-
unregisterOptionsWidgetFactory
(self, factory: QgsOptionsWidgetFactory)¶ Unregister a previously registered tab in the options dialog.
See also
See also
New in version 3.0.
-
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.
- Returns
An instance of the vector layer tools
-
vectorMenu
(self) → QMenu¶ Returns a reference to the main window “Vector” menu.
-
vectorToolBar
(self) → QToolBar¶ Returns a reference to the main window “Vector” toolbar.
-
viewMenu
(self) → QMenu¶ Returns a reference to the main window “View” menu.
-
webMenu
(self) → QMenu¶ Returns a reference to the main window “Web” menu.
-
webToolBar
(self) → QToolBar¶ Returns a reference to the main window “Web” toolbar.
-
windowMenu
(self) → QMenu¶ Returns a reference to the main window “Window” menu.
-
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.
-