QgisInterface class
QgisInterface Abstract base class defining interfaces exposed by QgisApp and made available to plugins.
Contents
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.
Constructors, destructors, conversion operators
- QgisInterface() defaulted
- Constructor.
Public functions
- auto actionAddAfsLayer() -> QAction* pure virtual
- Returns the native Add ArcGIS FeatureServer action.
- auto actionAddAmsLayer() -> QAction* pure virtual
- Returns the native Add ArcGIS MapServer action.
- auto actionAddFeature() -> QAction* pure virtual
- Returns the native Add Feature action.
- auto actionAddPart() -> QAction* pure virtual
- Returns the native Add Part action.
- auto actionAddRing() -> QAction* pure virtual
- Returns the native Add Ring action.
- auto actionCopyFeatures() -> QAction* pure virtual
- Returns the native Copy Features action.
- auto actionCreatePrintLayout() -> QAction* pure virtual
- Create new print layout action.
- auto actionCutFeatures() -> QAction* pure virtual
- Returns the native Cut Features action.
- auto actionDeletePart() -> QAction* pure virtual
- Returns the native Delete Part action.
- auto actionDeleteRing() -> QAction* pure virtual
- Returns the native Delete Ring action.
- auto actionDeleteSelected() -> QAction* pure virtual
- Returns the native Delete Selected Features action.
- auto actionDraw() -> QAction* pure virtual
- Returns the native draw action.
- auto actionExit() -> QAction* pure virtual
- Returns the Exit QGIS action.
- auto actionFeatureAction() -> QAction* pure virtual
- Returns the native run action feature action. Call trigger() on it to set the default run feature action map tool.
- auto actionHideDeselectedLayers() -> QAction* pure virtual
- Returns the Hide Deselected Layers action.
- auto actionIdentify() -> QAction* pure virtual
- Returns the native identify action. Call trigger() on it to set the default identify map tool.
- auto actionMapTips() -> QAction* pure virtual
- Returns the native map tips action. Call trigger() on it to toggle map tips.
- auto actionMeasure() -> QAction* pure virtual
- Returns the native measure action. Call trigger() on it to set the default measure map tool.
- auto actionMeasureArea() -> QAction* pure virtual
- Returns the native measure area action. Call trigger() on it to set the default measure area map tool.
- auto actionMoveFeature() -> QAction* pure virtual
- Returns the native Move Features action.
- auto actionNewBookmark() -> QAction* pure virtual
- Returns the native new bookmark action. Call trigger() on it to open the new bookmark dialog.
- auto actionNewProject() -> QAction* pure virtual
- Returns the native New Project action.
- auto actionOpenProject() -> QAction* pure virtual
- Returns the Open Project action.
- auto actionOpenStatisticalSummary() -> QAction* pure virtual
- Statistical summary action.
- auto actionPan() -> QAction* pure virtual
- Returns the native pan action. Call trigger() on it to set the default pan map tool.
- auto actionPanToSelected() -> QAction* pure virtual
- Returns the native pan to selected action. Call trigger() on it to pan the map canvas to the selection.
- auto actionPasteFeatures() -> QAction* pure virtual
- Returns the native Paste Features action.
- auto actionProjectProperties() -> QAction* pure virtual
- Returns the native Project Properties action.
- auto actionSaveMapAsImage() -> QAction* pure virtual
- Returns the native Save Map as Image action.
- auto actionSaveProject() -> QAction* pure virtual
- Returns the native Save Project action.
- auto actionSaveProjectAs() -> QAction* pure virtual
- Returns the native Save Project As action.
- auto actionSelect() -> QAction* pure virtual
- Returns the native select action. Call trigger() on it to set the default select map tool.
- auto actionSelectFreehand() -> QAction* pure virtual
- Returns the native select freehand action. Call trigger() on it to set the default select freehand map tool.
- auto actionSelectPolygon() -> QAction* pure virtual
- Returns the native select polygon action. Call trigger() on it to set the default select polygon map tool.
- auto actionSelectRadius() -> QAction* pure virtual
- Returns the native select radius action. Call trigger() on it to set the default select radius map tool.
- auto actionSelectRectangle() -> QAction* pure virtual
- Returns the native select rectangle action. Call trigger() on it to set the default select rectangle map tool.
- auto actionShowBookmarks() -> QAction* pure virtual
- Returns the native show bookmarks action. Call trigger() on it to open the bookmarks dialog.
- auto actionShowLayoutManager() -> QAction* pure virtual
- Show layout manager action.
- auto actionSimplifyFeature() -> QAction* pure virtual
- Returns the native Simplify/Smooth Features action.
- auto actionSplitFeatures() -> QAction* pure virtual
- Returns the native Split Features action.
- auto actionSplitParts() -> QAction* pure virtual
- Returns the native Split Parts action.
- auto actionVertexTool() -> QAction* pure virtual
- Returns the native Vertex Tool action.
- auto actionZoomActualSize() -> QAction* pure virtual
- Returns the native zoom resolution (100%) action. Call trigger() on it to zoom to actual size.
- auto actionZoomFullExtent() -> QAction* pure virtual
- Returns the native zoom full extent action. Call trigger() on it to zoom to the full extent.
- auto actionZoomIn() -> QAction* pure virtual
- Returns the native zoom in action. Call trigger() on it to set the default zoom in map tool.
- auto actionZoomLast() -> QAction* pure virtual
- Returns the native zoom last action. Call trigger() on it to zoom to last.
- auto actionZoomNext() -> QAction* pure virtual
- Returns the native zoom next action. Call trigger() on it to zoom to next.
- auto actionZoomOut() -> QAction* pure virtual
- Returns the native zoom out action. Call trigger() on it to set the default zoom out map tool.
- auto actionZoomToLayer() -> QAction* pure virtual
- Returns the native zoom to layer action. Call trigger() on it to zoom to the active layer.
- auto actionZoomToSelected() -> QAction* pure virtual
- Returns the native zoom to selected action. Call trigger() on it to zoom to the current selection.
- auto activeLayer() -> QgsMapLayer* pure virtual
- Returns a pointer to the active layer (layer selected in the legend)
- void addCustomActionForLayer(QAction* action, QgsMapLayer* layer) pure virtual
- Add action to context menu for a specific layer in the layer tree.
-
void addCustomActionForLayerType(QAction* action,
QString menu,
QgsMapLayer::
LayerType type, bool allLayers) pure virtual - Add action to context menu for layers in the layer tree.
- auto addLayerMenu() -> QMenu* pure virtual
- Returns a reference to the main window "Add Layer" menu.
- auto advancedDigitizeToolBar() -> QToolBar* pure virtual
- Returns a reference to the main window "Advanced Digitizing" toolbar.
- auto attributesToolBar() -> QToolBar* pure virtual
- Returns a reference to the main window "Attributes" toolbar.
- auto cadDockWidget() -> QgsAdvancedDigitizingDockWidget* pure virtual
- Advanced digitizing dock widget.
- void closeMapCanvas(const QString& name) pure virtual
- Closes the additional map canvas with matching name.
- auto createNewMapCanvas(const QString& name) -> QgsMapCanvas* pure virtual
- Create a new map canvas with the specified unique name.
- auto databaseMenu() -> QMenu* pure virtual
- Returns a reference to the main window "Database" menu.
- auto databaseToolBar() -> QToolBar* pure virtual
- Returns a reference to the main window "Database" toolbar.
- auto dataSourceManagerToolBar() -> QToolBar* pure virtual
- Returns a reference to the main window "Data Source Manager" toolbar.
- auto defaultStyleSheetFont() -> QFont pure virtual
- Returns a reference font for initial qApp (may not be same as QgisApp)
- auto defaultStyleSheetOptions() -> QMap<QString, QVariant> pure virtual
- Returns changeable options built from settings and/or defaults.
- auto digitizeToolBar() -> QToolBar* pure virtual
- Returns a reference to the main window "Digitize" toolbar.
- auto editableLayers(bool modified = false) const -> QList<QgsMapLayer*> pure virtual
- Returns vector layers in edit mode.
- auto editMenu() -> QMenu* pure virtual
- Returns a reference to the main window "Edit" menu.
- auto fileToolBar() -> QToolBar* pure virtual
- Returns a reference to the main window "File" toolbar.
- auto firstRightStandardMenu() -> QMenu* pure virtual
- Returns a reference to the right most standard menu, which is usually the last menu item before the "Help" menu.
- auto helpMenu() -> QMenu* pure virtual
- Returns a reference to the main window "Help" menu.
- auto helpToolBar() -> QToolBar* pure virtual
- Returns a reference to the main window "Help" toolbar.
- auto iconSize(bool dockedToolbar = false) const -> QSize pure virtual
- Returns the toolbar icon size.
- auto layerMenu() -> QMenu* pure virtual
- Returns a reference to the main window "Layer" menu.
- auto layerToolBar() -> QToolBar* pure virtual
- Returns a reference to the main window "Layer" toolbar.
- auto layerTreeCanvasBridge() -> QgsLayerTreeMapCanvasBridge* pure virtual
- Returns a pointer to the layer tree canvas bridge.
- auto mainWindow() -> QWidget* pure virtual
- Returns a pointer to the main window (instance of QgisApp in case of QGIS)
- auto mapCanvas() -> QgsMapCanvas* pure virtual
- Returns a pointer to the map canvas.
- auto mapCanvases() -> QList<QgsMapCanvas*> pure virtual
- Returns a list of all map canvases open in the app.
- auto mapNavToolToolBar() -> QToolBar* pure virtual
- Returns a reference to the main window "Map Navigation" toolbar.
- auto messageBar() -> QgsMessageBar* pure virtual
- Returns the message bar of the main app.
- auto messageTimeout() -> int pure virtual
- Returns the timeout for timed messages: default of 5 seconds.
- auto newLayerMenu() -> QMenu* pure virtual
- Returns a reference to the main window "Create New Layer" menu.
- auto openLayoutDesigners() -> QList<QgsLayoutDesignerInterface*> pure virtual
- Returns all currently open layout designers.
- auto pluginMenu() -> QMenu* pure virtual
- Returns a reference to the main window "Plugin" menu.
- auto pluginToolBar() -> QToolBar* pure virtual
- Returns a reference to the main window "Plugin" toolbar.
- auto projectMenu() -> QMenu* pure virtual
- Returns a reference to the main window "Project" menu.
- auto rasterMenu() -> QMenu* pure virtual
- Returns a reference to the main window "Raster" menu.
- auto rasterToolBar() -> QToolBar* pure virtual
- Returns a reference to the main window "Raster" toolbar.
- auto removeCustomActionForLayerType(QAction* action) -> bool pure virtual
- Remove action for layers in the layer tree previously added with addCustomActionForLayerType()
- auto settingsMenu() -> QMenu* pure virtual
- Returns a reference to the main window "Settings" menu.
- auto shapeDigitizeToolBar() -> QToolBar* pure virtual
- Returns a reference to the main window "Shape Digitizing" toolbar.
- auto statusBarIface() -> QgsStatusBar* pure virtual
- Returns a pointer to the app's status bar interface.
- void takeAppScreenShots(const QString& saveDirectory, const int categories = 0) virtual
- Take screenshots for user documentation.
- auto vectorLayerTools() -> QgsVectorLayerTools* pure virtual
- Access the vector layer tools instance.
- auto vectorMenu() -> QMenu* pure virtual
- Returns a reference to the main window "Vector" menu.
- auto vectorToolBar() -> QToolBar* pure virtual
- Returns a reference to the main window "Vector" toolbar.
- auto viewMenu() -> QMenu* pure virtual
- Returns a reference to the main window "View" menu.
- auto webMenu() -> QMenu* pure virtual
- Returns a reference to the main window "Web" menu.
- auto webToolBar() -> QToolBar* pure virtual
- Returns a reference to the main window "Web" toolbar.
- auto windowMenu() -> QMenu* pure virtual
- Returns a reference to the main window "Window" menu.
Signals
- void currentLayerChanged(QgsMapLayer* layer)
- Emitted whenever current (selected) layer changes.
- void currentThemeChanged(const QString& theme)
- Signal emitted when the current theme is changed so plugins can change their tool button icons.
- void initializationCompleted()
- This signal is emitted when the initialization is complete.
- void layerSavedAs(QgsMapLayer* l, const QString& path)
- This signal is emitted when a layer has been saved using save as.
- void layoutDesignerClosed()
- This signal is emitted after a layout designer window is closed.
- void layoutDesignerOpened(QgsLayoutDesignerInterface* designer)
- This signal is emitted when a new layout designer has been opened.
- void layoutDesignerWillBeClosed(QgsLayoutDesignerInterface* designer)
- This signal is emitted before a layout designer is going to be closed and deleted.
- void newProjectCreated()
- Emitted when starting an entirely new project.
- void projectRead()
- Emitted when a project file is successfully read.
Public slots
- auto addDatabaseToolBarIcon(QAction* qAction) -> int pure virtual
- Add an icon to the Database toolbar.
- auto addDatabaseToolBarWidget(QWidget* widget) -> QAction* pure virtual
- Add a widget to the database toolbar.
- void addDockWidget(Qt::DockWidgetArea area, QDockWidget* dockwidget) pure virtual
- Adds a dock widget to the main window, in the specified dock area.
- auto addMeshLayer(const QString& url, const QString& baseName, const QString& providerKey) -> QgsMeshLayer* pure virtual
- Adds a mesh layer to the current project.
- void addPluginToDatabaseMenu(const QString& name, QAction* action) pure virtual
- Add action to the Database menu.
- void addPluginToMenu(const QString& name, QAction* action) pure virtual
- Add action to the plugins menu.
- void addPluginToRasterMenu(const QString& name, QAction* action) pure virtual
- Add action to the Raster menu.
- void addPluginToVectorMenu(const QString& name, QAction* action) pure virtual
- Add action to the Vector menu.
- void addPluginToWebMenu(const QString& name, QAction* action) pure virtual
- Add action to the Web menu.
- auto addProject(const QString& project) -> bool pure virtual
- Adds (opens) a project.
- auto addRasterLayer(const QString& rasterLayerPath, const QString& baseName = QString()) -> QgsRasterLayer* pure virtual
- Adds a raster layer to the current project, given a raster layer file name.
- auto addRasterLayer(const QString& url, const QString& layerName, const QString& providerKey) -> QgsRasterLayer* pure virtual
- Adds a raster layer to the current project, from the specified raster data provider.
- auto addRasterToolBarIcon(QAction* qAction) -> int pure virtual
- Add an icon to the Raster toolbar.
- auto addRasterToolBarWidget(QWidget* widget) -> QAction* pure virtual
- Add a widget to the raster toolbar.
- auto addToolBar(const QString& name) -> QToolBar* pure virtual
- Add toolbar with specified name.
- void addToolBar(QToolBar* toolbar, Qt::ToolBarArea area = Qt::TopToolBarArea) pure virtual
- Add a toolbar.
- auto addToolBarIcon(QAction* qAction) -> int pure virtual
- Add an icon to the plugins toolbar.
- auto addToolBarWidget(QWidget* widget) -> QAction* pure virtual
- Add a widget to the plugins toolbar.
- void addUserInputWidget(QWidget* widget) pure virtual
- Adds a widget to the user input tool bar.
- auto addVectorLayer(const QString& vectorLayerPath, const QString& baseName, const QString& providerKey) -> QgsVectorLayer* pure virtual
- Adds a vector layer to the current project.
- auto addVectorToolBarIcon(QAction* qAction) -> int pure virtual
- Add an icon to the Vector toolbar.
- auto addVectorToolBarWidget(QWidget* widget) -> QAction* pure virtual
- Add a widget to the vector toolbar.
- auto addWebToolBarIcon(QAction* qAction) -> int pure virtual
- Add an icon to the Web toolbar.
- auto addWebToolBarWidget(QWidget* widget) -> QAction* pure virtual
- Add a widget to the web toolbar.
- void addWindow(QAction* action) pure virtual
- Add window to Window menu.
- auto askForDatumTransform(QgsCoordinateReferenceSystem sourceCrs, QgsCoordinateReferenceSystem destinationCrs) -> bool pure virtual
- Checks available datum transforms and ask user if several are available and none is chosen.
- auto browserModel() -> QgsBrowserModel* pure virtual
- Returns the application browser model.
- void buildStyleSheet(const QMap<QString, QVariant>& opts) pure virtual
- Generate stylesheet.
- void copySelectionToClipboard(QgsMapLayer*) pure virtual
- Copy selected features from the layer to clipboard.
- void deregisterLocatorFilter(QgsLocatorFilter* filter) pure virtual
- Deregisters a locator filter from the app's locator bar and deletes it.
- auto getFeatureForm(QgsVectorLayer* l, QgsFeature& f) -> QgsAttributeDialog* pure virtual
- Returns a feature form for a given feature.
- void insertAddLayerAction(QAction* action) pure virtual
- Add "add layer" action to layer menu.
- void invalidateLocatorResults() pure virtual
- Invalidate results from the locator filter.
- void newProject(bool promptToSaveFlag = false) pure virtual
- Starts a new blank project.
- auto openFeatureForm(QgsVectorLayer* l, QgsFeature& f, bool updateFeatureOnly = false, bool showModal = true) -> bool pure virtual
- Opens a new feature form.
- auto openLayoutDesigner(QgsMasterLayoutInterface* layout) -> QgsLayoutDesignerInterface* pure virtual
- 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.
- void openMessageLog() pure virtual
- Opens the message log dock widget.
- auto openURL(const QString& url, bool useQgisDocDirectory = true) -> Q_DECL_DEPRECATED void deprecated pure virtual
- Open a url in the users browser.
- void pasteFromClipboard(QgsMapLayer*) pure virtual
- Paste features from clipboard to the layer.
- void preloadForm(const QString& uifile) pure virtual
- 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.
- void registerCustomDropHandler(QgsCustomDropHandler* handler) pure virtual
- Register a new custom drop handler.
- void registerCustomLayoutDropHandler(QgsLayoutCustomDropHandler* handler) pure virtual
- Register a new custom drop handler for layout windows.
- void registerLocatorFilter(QgsLocatorFilter* filter) pure virtual
- Registers a locator filter for the app's locator bar.
- auto registerMainWindowAction(QAction* action, const QString& defaultShortcut) -> bool pure virtual
- Register action to the shortcuts manager so its shortcut can be changed in GUI.
- void registerMapLayerConfigWidgetFactory(QgsMapLayerConfigWidgetFactory* factory) pure virtual
- Register a new tab in the vector layer properties dialog.
- void registerOptionsWidgetFactory(QgsOptionsWidgetFactory* factory) pure virtual
- Register a new tab in the options dialog.
- void reloadConnections() pure virtual
- Triggered when connections have changed.
- void removeAddLayerAction(QAction* action) pure virtual
- Remove "add layer" action from layer menu.
- void removeDatabaseToolBarIcon(QAction* qAction) pure virtual
- Remove an action (icon) from the Database toolbar.
- void removeDockWidget(QDockWidget* dockwidget) pure virtual
- Removes the specified dock widget from main window (without deleting it).
- void removePluginDatabaseMenu(const QString& name, QAction* action) pure virtual
- Remove action from the Database menu.
- void removePluginMenu(const QString& name, QAction* action) pure virtual
- Remove action from the plugins menu.
- void removePluginRasterMenu(const QString& name, QAction* action) pure virtual
- Remove action from the Raster menu.
- void removePluginVectorMenu(const QString& name, QAction* action) pure virtual
- Remove action from the Vector menu.
- void removePluginWebMenu(const QString& name, QAction* action) pure virtual
- Remove action from the Web menu.
- void removeRasterToolBarIcon(QAction* qAction) pure virtual
- Remove an action (icon) from the Raster toolbar.
- void removeToolBarIcon(QAction* qAction) pure virtual
- Remove an action (icon) from the plugin toolbar.
- void removeVectorToolBarIcon(QAction* qAction) pure virtual
- Remove an action (icon) from the Vector toolbar.
- void removeWebToolBarIcon(QAction* qAction) pure virtual
- Remove an action (icon) from the Web toolbar.
- void removeWindow(QAction* action) pure virtual
- Remove window from Window menu.
- void saveStyleSheetOptions(const QMap<QString, QVariant>& opts) pure virtual
- Save changed default option keys/values to user settings.
- auto setActiveLayer(QgsMapLayer*) -> bool pure virtual
- Set the active layer (layer gets selected in the legend) returns true if the layer exists, false otherwise.
- auto showAttributeTable(QgsVectorLayer* l, const QString& filterExpression = QString()) -> QDialog* pure virtual
- Open attribute table dialog.
- void showLayerProperties(QgsMapLayer* l) pure virtual
- Open layer properties dialog.
- void showLayoutManager() pure virtual
- Opens the layout manager dialog.
- void showOptionsDialog(QWidget* parent = nullptr, const QString& currentPage = QString()) pure virtual
- Opens the options dialog.
- void unregisterCustomDropHandler(QgsCustomDropHandler* handler) pure virtual
- Unregister a previously registered custom drop handler.
- void unregisterCustomLayoutDropHandler(QgsLayoutCustomDropHandler* handler) pure virtual
- Unregister a previously registered custom drop handler for layout windows.
- auto unregisterMainWindowAction(QAction* action) -> bool pure virtual
- Unregister a previously registered action. (e.g. when plugin is going to be unloaded)
- void unregisterMapLayerConfigWidgetFactory(QgsMapLayerConfigWidgetFactory* factory) pure virtual
- Unregister a previously registered tab in the vector layer properties dialog.
- void unregisterOptionsWidgetFactory(QgsOptionsWidgetFactory* factory) pure virtual
- Unregister a previously registered tab in the options dialog.
- void zoomFull() pure virtual
- Zooms to the full extent of all map layers.
- void zoomToActiveLayer() pure virtual
- Zooms to extent of the active layer.
- void zoomToNext() pure virtual
- Zooms to the next view extent.
- void zoomToPrevious() pure virtual
- Zooms to the previous view extent.
Function documentation
QAction* QgisInterface:: actionHideDeselectedLayers() pure virtual
Returns the Hide Deselected Layers action.
QAction* QgisInterface:: actionOpenStatisticalSummary() pure virtual
Statistical summary action.
void QgisInterface:: addCustomActionForLayer(QAction* action,
QgsMapLayer* layer) pure virtual
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.
void QgisInterface:: addCustomActionForLayerType(QAction* action,
QString menu,
QgsMapLayer:: LayerType type,
bool allLayers) pure virtual
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.
QMenu* QgisInterface:: addLayerMenu() pure virtual
Returns a reference to the main window "Add Layer" menu.
QgsAdvancedDigitizingDockWidget* QgisInterface:: cadDockWidget() pure virtual
Advanced digitizing dock widget.
void QgisInterface:: closeMapCanvas(const QString& name) pure virtual
Closes the additional map canvas with matching name.
QgsMapCanvas* QgisInterface:: createNewMapCanvas(const QString& name) pure virtual
Create a new map canvas with the specified unique name.
QToolBar* QgisInterface:: dataSourceManagerToolBar() pure virtual
Returns a reference to the main window "Data Source Manager" toolbar.
QList<QgsMapLayer*> QgisInterface:: editableLayers(bool modified = false) const pure virtual
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 |
QMenu* QgisInterface:: firstRightStandardMenu() pure virtual
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.
QSize QgisInterface:: iconSize(bool dockedToolbar = false) const pure virtual
Returns the toolbar icon size.
If dockedToolbar is true, the icon size for toolbars contained within docks is returned.
QgsLayerTreeMapCanvasBridge* QgisInterface:: layerTreeCanvasBridge() pure virtual
Returns a pointer to the layer tree canvas bridge.
QList<QgsMapCanvas*> QgisInterface:: mapCanvases() pure virtual
Returns a list of all map canvases open in the app.
QList<QgsLayoutDesignerInterface*> QgisInterface:: openLayoutDesigners() pure virtual
Returns all currently open layout designers.
bool QgisInterface:: removeCustomActionForLayerType(QAction* action) pure virtual
Remove action for layers in the layer tree previously added with addCustomActionForLayerType()
QToolBar* QgisInterface:: shapeDigitizeToolBar() pure virtual
Returns a reference to the main window "Shape Digitizing" toolbar.
QgsStatusBar* QgisInterface:: statusBarIface() pure virtual
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).
void QgisInterface:: takeAppScreenShots(const QString& saveDirectory,
const int categories = 0) virtual
Take screenshots for user documentation.
| Parameters | |
|---|---|
| saveDirectory | path where the screenshots will be saved |
| categories | an int as a flag value of QgsAppScreenShots::Categories |
QgsVectorLayerTools* QgisInterface:: vectorLayerTools() pure virtual
Access the vector layer tools instance.
| Returns | An instance of the vector layer tools |
|---|
With the help of this you can access methods like addFeature, startEditing or stopEditing while giving the user the appropriate dialogs.
void QgisInterface:: currentLayerChanged(QgsMapLayer* layer) signal
Emitted whenever current (selected) layer changes.
The pointer to layer can be null if no layer is selected.
void QgisInterface:: currentThemeChanged(const QString& theme) signal
Signal emitted when the current theme is changed so plugins can change their tool button icons.
void QgisInterface:: layerSavedAs(QgsMapLayer* l,
const QString& path) signal
This signal is emitted when a layer has been saved using save as.
void QgisInterface:: layoutDesignerClosed() signal
This signal is emitted after a layout designer window is closed.
void QgisInterface:: layoutDesignerOpened(QgsLayoutDesignerInterface* designer) signal
This signal is emitted when a new layout designer has been opened.
void QgisInterface:: layoutDesignerWillBeClosed(QgsLayoutDesignerInterface* designer) signal
This signal is emitted before a layout designer is going to be closed and deleted.
void QgisInterface:: newProjectCreated() signal
Emitted when starting an entirely new project.
void QgisInterface:: projectRead() signal
Emitted when a project file is successfully read.
QAction* QgisInterface:: addDatabaseToolBarWidget(QWidget* widget) pure virtual public slot
Add a widget to the database toolbar.
| 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 |
To remove this widget again, call removeDatabaseToolBarIcon() with the returned QAction.
void QgisInterface:: addDockWidget(Qt::DockWidgetArea area,
QDockWidget* dockwidget) pure virtual public slot
Adds a dock widget to the main window, in the specified dock area.
QAction* QgisInterface:: addRasterToolBarWidget(QWidget* widget) pure virtual public slot
Add a widget to the raster toolbar.
| 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 |
To remove this widget again, call removeRasterToolBarIcon() with the returned QAction.
void QgisInterface:: addToolBar(QToolBar* toolbar,
Qt::ToolBarArea area = Qt::TopToolBarArea) pure virtual public slot
Add a toolbar.
QAction* QgisInterface:: addToolBarWidget(QWidget* widget) pure virtual public slot
Add a widget to the plugins toolbar.
| 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 |
To remove this widget again, call removeToolBarIcon() with the returned QAction.
QAction* QgisInterface:: addVectorToolBarWidget(QWidget* widget) pure virtual public slot
Add a widget to the vector toolbar.
| 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 |
To remove this widget again, call removeVectorToolBarIcon() with the returned QAction.
QAction* QgisInterface:: addWebToolBarWidget(QWidget* widget) pure virtual public slot
Add a widget to the web toolbar.
| 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 |
To remove this widget again, call removeWebToolBarIcon() with the returned QAction.
void QgisInterface:: addWindow(QAction* action) pure virtual public slot
Add window to Window menu.
The action title is the window title and the action should raise, unminimize and activate the window.
bool QgisInterface:: askForDatumTransform(QgsCoordinateReferenceSystem sourceCrs,
QgsCoordinateReferenceSystem destinationCrs) pure virtual public slot
Checks available datum transforms and ask user if several are available and none is chosen.
| Returns | true if a datum transform has been specifically chosen by user or only one is available. |
|---|
Dialog is shown only if global option is set accordingly.
QgsBrowserModel* QgisInterface:: browserModel() pure virtual public slot
Returns the application browser model.
Using this shared model is more efficient than creating a new browser model for every use.
void QgisInterface:: buildStyleSheet(const QMap<QString, QVariant>& opts) pure virtual public slot
Generate stylesheet.
| Parameters | |
|---|---|
| opts | generated default option values, or a changed copy of them |
void QgisInterface:: copySelectionToClipboard(QgsMapLayer*) pure virtual public slot
Copy selected features from the layer to clipboard.
void QgisInterface:: deregisterLocatorFilter(QgsLocatorFilter* filter) pure virtual public slot
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.
QgsAttributeDialog* QgisInterface:: getFeatureForm(QgsVectorLayer* l,
QgsFeature& f) pure virtual public slot
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 |
void QgisInterface:: invalidateLocatorResults() pure virtual public slot
Invalidate results from the locator filter.
This might be useful if the configuration of the filter changed without going through main application settings.
bool QgisInterface:: openFeatureForm(QgsVectorLayer* l,
QgsFeature& f,
bool updateFeatureOnly = false,
bool showModal = true) pure virtual public slot
Opens a new feature form.
| 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) |
Returns true if dialog was accepted (if shown modal, true otherwise).
QgsLayoutDesignerInterface* QgisInterface:: openLayoutDesigner(QgsMasterLayoutInterface* layout) pure virtual public slot
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.
Q_DECL_DEPRECATED void QgisInterface:: openURL(const QString& url,
bool useQgisDocDirectory = true) pure virtual public slot
Open a url in the users browser.
| 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) |
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.
void QgisInterface:: pasteFromClipboard(QgsMapLayer*) pure virtual public slot
Paste features from clipboard to the layer.
void QgisInterface:: preloadForm(const QString& uifile) pure virtual public slot
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:/
void QgisInterface:: registerCustomDropHandler(QgsCustomDropHandler* handler) pure virtual public slot
Register a new custom drop handler.
void QgisInterface:: registerCustomLayoutDropHandler(QgsLayoutCustomDropHandler* handler) pure virtual public slot
Register a new custom drop handler for layout windows.
void QgisInterface:: registerLocatorFilter(QgsLocatorFilter* filter) pure virtual public slot
Registers a locator filter for the app's locator bar.
Ownership of the filter is transferred to the locator.
void QgisInterface:: registerMapLayerConfigWidgetFactory(QgsMapLayerConfigWidgetFactory* factory) pure virtual public slot
Register a new tab in the vector layer properties dialog.
void QgisInterface:: registerOptionsWidgetFactory(QgsOptionsWidgetFactory* factory) pure virtual public slot
Register a new tab in the options dialog.
void QgisInterface:: reloadConnections() pure virtual public slot
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)
void QgisInterface:: removeDockWidget(QDockWidget* dockwidget) pure virtual public slot
Removes the specified dock widget from main window (without deleting it).
void QgisInterface:: removeWindow(QAction* action) pure virtual public slot
Remove window from Window menu.
Calling this is necessary only for windows which are hidden rather than deleted when closed.
void QgisInterface:: showLayoutManager() pure virtual public slot
Opens the layout manager dialog.
void QgisInterface:: showOptionsDialog(QWidget* parent = nullptr,
const QString& currentPage = QString()) pure virtual public slot
Opens the options dialog.
The currentPage argument can be used to force the dialog to open at a specific page.
void QgisInterface:: unregisterCustomDropHandler(QgsCustomDropHandler* handler) pure virtual public slot
Unregister a previously registered custom drop handler.
void QgisInterface:: unregisterCustomLayoutDropHandler(QgsLayoutCustomDropHandler* handler) pure virtual public slot
Unregister a previously registered custom drop handler for layout windows.
void QgisInterface:: unregisterMapLayerConfigWidgetFactory(QgsMapLayerConfigWidgetFactory* factory) pure virtual public slot
Unregister a previously registered tab in the vector layer properties dialog.
void QgisInterface:: unregisterOptionsWidgetFactory(QgsOptionsWidgetFactory* factory) pure virtual public slot
Unregister a previously registered tab in the options dialog.