QGIS API Documentation  3.0.2-Girona (307d082)
Backwards Incompatible Changes

Table of Contents

The API of QGIS libraries is allowed to be changed just between major versions of QGIS. For example, there are various planned backwards incompatible changes between QGIS 1.8 and 2.0 because the version 2.0 is a new major version. After a release of a major version of QGIS (e.g. 2.0) the developer team is committed to maintain stable API for all subsequent minor releases (2.2, 2.4, ...). That roughly means we do not rename classes and methods, remove them nor change their semantics. Existing code should keep working when the user updates QGIS to another minor version (e.g. from 2.0 to 2.2), so all extensions of existing classes should be done in a manner that third party developers do not need to adjust their code to work properly with newer QGIS releases.

Sometimes, however, we may need to break the API as a result of some code changes. These cases should be only exceptions and they should happen only after consideration and agreement of the development team. Backwards incompatible changes with too big impact should be deferred to a major version release.

This page tries to maintain a list with incompatible changes that happened in previous releases.

QGIS 3.0

Version 3.0 brings changes to many underlying dependencies which QGIS is built upon. Any existing PyQGIS code will need to be updated to address the changes made within these libraries.

Python 3.0

QGIS 3.0 introduces a move to Python 3. This version brings many changes to both the Python language and individual Python libraries. A good place to start learning about the changes involved, and how to port your code to Python 3, is available in the official Python documentation: Porting Python 2 Code to Python 3.

Qt 5

QGIS 3.0 is based off version 5 of the underlying Qt libraries. Many changes and API breaks were introduced in Qt5. While it is c++ specific, a good place to read about the major changes introduced in Qt5 is at the Qt docs: C++ API changes

PyQt 5

Together with the Python and Qt version changes, the PyQt libraries which expose Qt classes to Python have also had their version bumped to PyQt 5. The changes introduced in PyQt 5 and the steps required to upgrade existing code are summarised at: Differences Between PyQt4 and PyQt5

Moved Classes

Moved classes
classModule 2.XModule 3.x
QgsMapLayerModelguicore
QgsMapLayerProxyModelguicore

Renamed Classes

Renamed classes
API 2.xAPI 3.X
QgisGuiQgsGuiUtils
QgsAbstractGeometryV2QgsAbstractGeometry
QgsArcProperterQgsStrategy
QgsAttributeActionQgsActionManager
QgsCategorizedSymbolRendererV2QgsCategorizedSymbolRenderer
QgsCategorizedSymbolRendererV2ModelQgsCategorizedSymbolRendererModel
QgsCategorizedSymbolRendererV2ViewStyleQgsCategorizedSymbolRendererViewStyle
QgsCategorizedSymbolRendererV2WidgetQgsCategorizedSymbolRendererWidget
QgsCentroidFillSymbolLayerV2QgsCentroidFillSymbolLayer
QgsCentroidFillSymbolLayerV2WidgetQgsCentroidFillSymbolLayerWidget
QgsCircularStringV2QgsCircularString
QgsColorButtonV2QgsColorButton
QgsCompoundCurveV2QgsCompoundCurve
QgsCoordinateSequenceV2QgsCoordinateSequence
QgsCptCityColorRampV2QgsCptCityColorRamp
QgsCptCityColorRampV2DialogQgsCptCityColorRampDialog
QgsCptCityColorRampV2DialogBaseQgsCptCityColorRampDialogBase
QgsCurvePolygonV2QgsCurvePolygon
QgsCurveV2QgsCurve
QgsDbFilterProxyModelQgsDatabaseFilterProxyModel
QgsDiagramRendererV2QgsDiagramRenderer
QgsDistanceArcProperterQgsDistanceStrategy
QgsDoubleBoxBarStyleQgsDoubleBoxScaleBarRenderer
QgsEditorWidgetV2QgsEditorWidget
QgsEllipseSymbolLayerV2QgsEllipseSymbolLayer
QgsEllipseSymbolLayerV2WidgetQgsEllipseSymbolLayerWidget
QgsFavouritesItemQgsFavoritesItem
QgsFeatureRendererV2QgsFeatureRenderer
QgsFillSymbolLayerV2QgsFillSymbolLayer
QgsFillSymbolV2QgsFillSymbol
QgsFontMarkerSymbolLayerV2QgsFontMarkerSymbolLayer
QgsFontMarkerSymbolLayerV2WidgetQgsFontMarkerSymbolLayerWidget
QgsGeometryCollectionV2QgsGeometryCollection
QgsGeometryGeneratorSymbolLayerV2QgsGeometryGeneratorSymbolLayer
QgsGPSConnectionQgsGpsConnection
QgsGPSConnectionRegistryQgsGpsConnectionRegistry
QgsGPSDetectorQgsGpsDetector
QgsGPSInformationQgsGpsInformation
QgsGradientFillSymbolLayerV2QgsGradientFillSymbolLayer
QgsGradientFillSymbolLayerV2WidgetQgsGradientFillSymbolLayerWidget
QgsGraduatedSymbolRendererV2QgsGraduatedSymbolRenderer
QgsGraduatedSymbolRendererV2ModelQgsGraduatedSymbolRendererModel
QgsGraduatedSymbolRendererV2ViewStyleQgsGraduatedSymbolRendererViewStyle
QgsGraduatedSymbolRendererV2WidgetQgsGraduatedSymbolRendererWidget
QgsGraphArcQgsGraphEdge
QgsJSONExporterQgsJsonExporter
QgsJSONUtilsQgsJsonUtils
QgsLabelingEngineV2QgsLabelingEngine
QgsLegendModelV2QgsLegendModel
QgsLegendSymbolItemV2QgsLegendSymbolItem
QgsLineStringV2QgsLineString
QgsLineSymbolLayerV2QgsLineSymbolLayer
QgsLineSymbolV2QgsLineSymbol
QgsMarkerLineSymbolLayerV2QgsMarkerLineSymbolLayer
QgsMarkerLineSymbolLayerV2WidgetQgsMarkerLineSymbolLayerWidget
QgsMarkerSymbolLayerV2QgsMarkerSymbolLayer
QgsMarkerSymbolV2QgsMarkerSymbol
QgsMultiCurveV2QgsMultiCurve
QgsMultiLineStringV2QgsMultiLineString
QgsMultiPointQgsMultiPointXY
QgsMultiPointV2QgsMultiPoint
QgsMultiPolygonQgsPolygonXY
QgsMultiPolygonV2QgsPolygon
QgsMultiPolylineQgsPolylineXY
QgsMultiPolylineV2QgsPolyline
QgsMultiSurfaceV2QgsMultiSurface
QgsNMEAConnectionQgsNmeaConnection
QgsNodeEditorQgsVertexEditor
QgsNodeToolQgsVertexTool
QgsNumericScaleBarStyleQgsNumericScaleBarRenderer
QgsPointQgsPointXY
QgsPointSequenceV2QgsPointSequence
QgsPointV2QgsPoint
QgsPolygonQgsPolygonXY
QgsPolygonV2QgsPolygon
QgsPolylineQgsPolylineXY
QgsPolylineV2QgsPolyline
QgsPropertyQgsProjectProperty
QgsPropertyKeyQgsProjectPropertyKey
QgsPropertyValueQgsProjectPropertyValue
QgsRandomColorsV2QgsRandomColorRamp
QgsRendererCategoryV2QgsRendererCategory
QgsRendererRangeV2QgsRendererRange
QgsRendererRangeV2LabelFomatQgsRendererRangeLabelFomat
QgsRendererRangeV2LabelFormatQgsRendererRangeLabelFormat
QgsRendererV2QgsRenderer
QgsRendererV2AbstractMetadataQgsRendererAbstractMetadata
QgsRendererV2CreateFromSldFuncQgsRendererCreateFromSldFunc
QgsRendererV2CreateFuncQgsRendererCreateFunc
QgsRendererV2DataDefinedMenusQgsRendererDataDefinedMenus
QgsRendererV2MetadataQgsRendererMetadata
QgsRendererV2PropertiesDialogQgsRendererPropertiesDialog
QgsRendererV2PropsDialogBaseQgsRendererPropsDialogBase
QgsRendererV2RegistryQgsRendererRegistry
QgsRendererV2WidgetQgsRendererWidget
QgsRendererV2WidgetFuncQgsRendererWidgetFunc
QgsRingSequenceV2QgsRingSequence
QgsRuleBasedRendererV2QgsRuleBasedRenderer
QgsRuleBasedRendererV2CountQgsRuleBasedRendererCount
QgsRuleBasedRendererV2ModelQgsRuleBasedRendererModel
QgsRuleBasedRendererV2WidgetQgsRuleBasedRendererWidget
QgsScaleBarStyleQgsScaleBarRenderer
QgsShapeburstFillSymbolLayerV2QgsShapeburstFillSymbolLayer
QgsShapeburstFillSymbolLayerV2WidgetQgsShapeburstFillSymbolLayerWidget
QgsSimpleFillSymbolLayerV2QgsSimpleFillSymbolLayer
QgsSimpleFillSymbolLayerV2WidgetQgsSimpleFillSymbolLayerWidget
QgsSimpleLineSymbolLayerV2QgsSimpleLineSymbolLayer
QgsSimpleLineSymbolLayerV2WidgetQgsSimpleLineSymbolLayerWidget
QgsSimpleMarkerSymbolLayerV2QgsSimpleMarkerSymbolLayer
QgsSimpleMarkerSymbolLayerV2WidgetQgsSimpleMarkerSymbolLayerWidget
QgsSingleBoxScaleBarStyleQgsSingleBoxScaleBarRenderer
QgsSingleSymbolRendererV2QgsSingleSymbolRenderer
QgsSingleSymbolRendererV2WidgetQgsSingleSymbolRendererWidget
QgsStyleV2QgsStyle
QgsStyleV2ExportImportDialogQgsStyleExportImportDialog
QgsStyleV2ExportImportDialogBaseQgsStyleExportImportDialogBase
QgsStyleV2GroupSelectionDialogQgsStyleGroupSelectionDialog
QgsStyleV2ManagerDialogQgsStyleManagerDialog
QgsStyleV2ManagerDialogBaseQgsStyleManagerDialogBase
QgsSurfaceV2QgsSurface
QgsSvgMarkerSymbolLayerV2QgsSvgMarkerSymbolLayer
QgsSvgMarkerSymbolLayerV2WidgetQgsSvgMarkerSymbolLayerWidget
QgsSymbolLayerV2QgsSymbolLayer
QgsSymbolLayerV2AbstractMetadataQgsSymbolLayerAbstractMetadata
QgsSymbolLayerV2MetadataQgsSymbolLayerMetadata
QgsSymbolLayerV2RegistryQgsSymbolLayerRegistry
QgsSymbolLayerV2UtilsQgsSymbolLayerUtils
QgsSymbolLayerV2WidgetQgsSymbolLayerWidget
QgsSymbolLevelsV2DialogQgsSymbolLevelsDialog
QgsSymbolV2QgsSymbol
QgsSymbolV2LegendNodeQgsSymbolLegendNode
QgsSymbolV2LevelItemQgsSymbolLevelItem
QgsSymbolV2RenderContextQgsSymbolRenderContext
QgsSymbolV2SelectorDialogQgsSymbolSelectorDialog
QgsSymbolV2SelectorWidgetQgsSymbolSelectorWidget
QgsTicksScaleBarStyleQgsTicksScaleBarRenderer
QgsTINInterpolatorQgsTinInterpolator
QgsUserInputDockWidgetQgsUserInputWidget
QgsVectorColorBrewerColorRampV2QgsColorBrewerColorRamp
QgsVectorColorBrewerColorRampV2DialogQgsColorBrewerColorRampDialog
QgsVectorColorBrewerColorRampV2DialogBaseQgsColorBrewerColorRampDialogBase
QgsVectorColorRampV2QgsColorRamp
QgsVectorColorRampV2MapQgsVectorColorRampMap
QgsVectorGradientColorRampV2QgsGradientColorRamp
QgsVectorGradientColorRampV2DialogQgsGradientColorRampDialog
QgsVectorGradientColorRampV2DialogBaseQgsGradientColorRampDialogBase
QgsVectorGradientRampV2QgsVectorGradientRamp
QgsVectorJoinInfoQgsVectorLayerJoinInfo
QgsVectorLayerImportQgsVectorLayerExporter
QgsVectorLayersetRendererV2QgsVectorLayersetRenderer
QgsVectorRandomColorRampV2QgsLimitedRandomColorRamp
QgsVectorRandomColorRampV2DialogQgsLimitedRandomColorRampDialog
QgsVectorRandomColorRampV2DialogBaseQgsLimitedRandomColorRampDialogBase
vertexDataQgsInterpolatorVertexData
Renamed enum values
classAPI 2.xAPI 3.X
QgsLayerTreeModelLegendNodeSymbolV2LegacyRuleKeyRoleSymbolLegacyRuleKeyRole
QgsVectorLayerEditorWidgetV2EditorWidget
Renamed method names
classAPI 2.xAPI 3.X
QgsAnnotationmapPositionFixedhasFixedMapPosition
QgsApplicationdefaultStyleV2PathdefaultStylePath
QgsApplicationuserStyleV2PathuserStylePath
QgsIFeatureSelectionManagerselectedFeaturesIdsselectedFeatureIds
QgsMapLayercapitaliseLayerNamecapitalizeLayerName
QgsSymbolLayerUtilscreateSymbolLayerV2ListFromSldcreateSymbolLayerListFromSld
QgsVectorLayereditorWidgetV2ConfigeditorWidgetConfig
QgsVectorLayereditorWidgetV2TexteditorWidgetText
QgsVectorLayereditorWidgetV2TypeeditorWidgetType
QgsVectorLayerdeleteVertexV2deleteVertex
QgsVectorLayerrendererV2renderer
QgsVectorLayerselectedFeaturesIdsselectedFeatureIds
QgsVectorLayerEditUtilsdeleteVertexV2deleteVertex
QgsServerInterfacecapabiblitiesCachecapabilitiesCache
QgsGraphEdgepropertycost
QgsGraphEdgepropertiesstrategies
QgsGraphVertexoutArcoutEdges
QgsGraphVertexinArcinEdges
QgsGraphaddArcaddEdges
QgsGrapharcCountedgeCount
QgsGrapharcedge
QgsGraphBuilderaddArcaddEdge
QgsGraphBuilderInterfaceaddArcaddEdge
QgsGraphDirectoryaddProperteraddStrategy
QgsRequestHandlergetHeaderheader
QgsStrategyaddProperteraddStrategy

Removed Classes

General changes

Composer

All composer related methods have been removed from the public API and Python bindings. These classes have been replaced with the new layouts engine, based on QgsLayout, QgsLayoutItem, and the other related classes.

Labeling

Labeling of vector layers used to be configured in 2.x using setCustomProperties() method with various lots of options prefixed with "labeling" keyword, for example: layer.setCustomProperties("labeling/fieldName", "my_field"). While 2.x projects and .qml files containing configuration using custom properties will still work, calling these API methods will have no effect on layer's labeling configuration anymore: all settings are now stored in objects derived from QgsAbstractVectorLayerLabeling:

The current configuration of labeling can be queried with vector layer's labeling() method and modified with setLabeling() method.

Data Providers

Qgis

QgisInterface

CharacterWidget

QgsAbstractGeometry

QgsActionManager

QgsAction

QgsAdvancedDigitizingDockWidget

QgsApplication

QgsAttributeDialog

QgsAttributeForm

QgsAuthConfigUriEdit

QgsAuthManager

QgsAuthMethod

QgsBlurEffect

QgsBrowserModel

QgsBrowserDockWidget

QgsCachedFeatureIterator

QgsCategorizedRenderer

QgsCategorizedSymbolRendererWidget

QgsClipper

QgsColorBrewerColorRampDialog

QgsColorBrewerPalette

QgsColorButton

QgsColorDialog

QgsColorEffect

QgsColorRampShader

QgsColorSchemeRegistry

QgsCompoundColorWidget

QgsConditionalLayerStyle

QgsConditionalStyle

QgsCoordinateReferenceSystem

QgsCoordinateTransform

QgsCoordinateTransformCache

QgsCptCityColorRamp

QgsCptCityColorRampDialog

QgsCptCityDataItem

QgsCptCitySelectionItem

QgsCustomLayerOrderWidget

QgsCRSCache

QgsCursors

QgsDataDefined

QgsDataDefinedValueDialog

QgsDataItem

QgsDataItemProviderRegistry

QgsDataProvider

QgsDataSourceURI

QgsDatumTransformStore

QgsDiagram

QgsDiagramInterpolationSettings

QgsDiagramRenderer

QgsDiagramLayerSettings

QgsDiagramSettings

QgsDial

QgsDistanceArea

QgsDrawSourceEffect

QgsDxfExport

QgsEditFormConfig

QgsEditorWidgetWrapper

QgsExpression

QgsExpression::Function

QgsExpressionItem

QgsExpressionContext

QgsExpressionContextUtils

QgsFeature

QgsFeatureIterator

QgsFeatureListViewDelegate

QgsFeatureRendererV2

QgsFeatureRequest

QgsFieldCombobox

QgsFieldExpressionWidget

QgsFields

QgsFieldProxyModel

QgsFileDownloader

QgsGeometry

QgsGeometryAnalyzer

QgsGeometryEngine

QgsGeometrySimplifier

QgsGlowEffect

QgsGradientColorRampDialog

QgsGraduatedSymbolRenderer

QgsGraduatedSymbolRenderer

QgsGraph

QgsGraphBuilderInterface

QgsGraphEdge

QgsGraphVertex

QgsEditorWidgetRegistry

QgsEditorWidgetFactory

QgsFeedback

QgsGeometryUtils

QgsGPSConnectionRegistry

QgsGraduatedRenderer

QgsGridFileWriter

QgsGroupWMSDataDialog

QgsHeatmapRenderer

QgsHighlight

QgsIFeatureSelectionManager

QgsInterpolator

QgsJSONExporter

QgsLabelingEngineInterface

QgsLayerDefinition

QgsLayerPropertiesWidget

QgsLayerTreeEmbeddedWidgetRegistry

QgsLayerTreeGroup

QgsLayerTreeLayer

QgsLayerTreeMapCanvasBridge

QgsLayerTreeModel

QgsLayerTreeModelLegendNode

QgsLayerTreeNode

QgsLimitedRandomColorRampDialog

QgsLinearlyInterpolatedDiagramRenderer

QgsMapCanvas

QgsMapCanvasItem

QgsMapLayer

QgsMapLayerActionRegistry

QgsMapLayerLegend

QgsMapMouseEvent

QgsMapOverviewCanvas

QgsMapRenderer

QgsMapRendererCache

QgsMapRendererJob

QgsMapTool

QgsMapToolAdvancedDigitizing

QgsMapToolCapture

QgsMapToPixel

QgsMapToPixelGeometrySimplifier

The whole class has been refactored to stop using WKB and to use QgsAbstractGeometry classes.

QgsMapSettings

QgsMapUnitScale

QgsMarkerSymbolLayer

QgsMessageBar

QgsMessageLog

QgsMessageLogViewer

QgsMimeDataUtils

QgsNetworkAccessManager

QgsNetworkStrategy

QgsNewVectorLayerDialog

QgsNineCellFilter

QgsOSMElement

QgsOSMXmlImport

QgsOwsConnection

QgsOWSSourceSelect

QgsOWSConnection

QgsNumericSortTreeWidgetItem

QgsPaintEffectRegistry

QgsPalettedRasterRenderer

QgsPalLabeling

QgsPalLayerSettings

QgsPanelWidgetStack

QgsPluginLayer

QgsPluginLayerRegistry

QgsPoint

QgsPointDisplacementRenderer

QgsPointLocator

QgsPolyline

QgsProject

QgsProjectionSelectionWidget

QgsProjectPropertyValue

QgsProviderRegistry

QgsRaster

QgsRasterBlock

QgsRasterCalcNode

QgsRasterCalculator

QgsRasterDataProvider

QgsRasterFileWriter

QgsRasterFillSymbolLayer

QgsRasterInterface

QgsRasterLayer

QgsRasterLayerSaveAsDialog

QgsRasterProjector

QgsRasterRenderer

QgsRasterRendererWidget

QgsRectangle

QgsRelation

QgsRelief

QgsRenderChecker

QgsRenderContext

QgsRendererRangeLabelFormat

QgsRendererRegistry

QgsRendererWidget

QgsRendererRulePropsWidget

QgsRequestHandler

QgsRubberBand

QgsRuleBasedRenderer

QgsRuleBasedRendererWidget

QgsRuntimeProfiler

QgsScaleBarStyle

QgsScaleComboBox

QgsScaleRangeWidget

QgsScaleVisibilityDialog

QgsScaleWidget

QgsServer

QgsShadowEffect

QgsShortcutsManager

QgsSimpleMarkerSymbolLayer

QgsSimpleMarkerSymbolLayerWidget

QgsSingleBandPseudoColorRenderer

QgsSingleSymbolRendererWidget

QgsSlider

QgsSnapper

QgsSnappingUtils

QgsSpatialIndex

QgsSublayersDialog

QgsSvgCache

QgsSvgCacheEntry

QgsSVGFillSymbolLayer

QgsSvgMarkerSymbolLayer

QgsSvgSelectorWidget

QgsSvgSelectorDialog

QgsStyle (renamed from QgsStyleV2)

QgsSymbol (renamed from QgsSymbolV2)

QgsSymbolLayer (renamed from QgsSymbolLayerV2)

QgsSymbolLayerRegistry

QgsSymbolLayerWidget

QgsSymbolRenderContext (renamed from QgsSymbolV2RenderContext)

QgsSymbolLayerUtils (renamed from QgsSymbolLayerUtilsV2)

QgsSymbolSelectorWidget

QgsSymbolSelectorDialog

QgsSymbolsListWidget

QgsTinInterpolator

QgsTolerance

QgsTracer

QgsTransaction

QgsTreeWidgetItem

QgsUnitTypes

QgsVector

QgsVectorDataProvider

QgsVectorJoinInfo

QgsVectorLayer

QgsVectorLayerEditBuffer

QgsVectorLayerEditUtils

QgsVectorLayerExporter (renamed from QgsVectorLayerImport)

QgsVectorLayerJoinBuffer

QgsVectorLayerUndoCommand

QgsVisibilityPresetCollection

QgsVectorFileWriter

QgsWMSLegendNode

QgsZipItem

QgsRenderer

QgsRendererAbstractMetadata

QgsGraphDirector

QgsVectorLayerDirector

Processing

Triangulation

QgsZonalStatistics

QGIS 2.6

Legend Refactoring

QGIS 2.4

Multi-threaded Rendering