Class: QgsCoordinateOperationWidget

A widget for selecting the coordinate operation to use when transforming between a source and destination coordinate reference system.

Added in version 3.12.

QgsCoordinateOperationWidget

QgsCoordinateOperationWidget

Class Hierarchy

Inheritance diagram of qgis.gui.QgsCoordinateOperationWidget

Base classes

QWidget

QObject

QPaintDevice

Methods

availableOperations

Returns a list of the available operations shown in the widget.

defaultOperation

Returns the details of the default operation suggested by the widget.

destinationCrs

Returns the destination CRS for the operations shown in the widget.

hasSelection

Returns True if there is a valid selection in the widget.

makeDefaultSelected

Returns True if the "make default" option is selected.

selectedOperation

Returns the details of the operation currently selected within the widget.

setDestinationCrs

Sets the destination crs for the operations shown in the widget.

setMapCanvas

Sets a map canvas to link to the widget, which allows the widget's choices to reflect the current canvas state.

setSelectedOperation

Sets the details of the operation currently selected within the widget.

setSelectedOperationUsingContext

Automatically sets the selected operation using the settings encapsulated in a transform context.

setShowFallbackOption

Sets whether the "allow fallback" operations option is visible.

setShowMakeDefault

Sets whether the "make default" checkbox should be shown.

setSourceCrs

Sets the source crs for the operations shown in the widget.

sourceCrs

Returns the source CRS for the operations shown in the widget.

Signals

operationChanged

Emitted when the operation selected in the dialog is changed.

operationDoubleClicked

Emitted when an operation is double-clicked in the widget.

class qgis.gui.QgsCoordinateOperationWidget[source]

Bases: QWidget

__init__(parent: QWidget | None = None)

Constructor for QgsCoordinateOperationWidget.

Parameters:

parent (Optional[QWidget] = None)

class OperationDetails

Bases: object

Coordinate operation details

allowFallback

True if fallback transforms can be used

destinationTransformId

Destination transform ID

isAvailable

True if operation is available

proj

Proj coordinate operation description, for Proj >= 6.0 builds only

sourceTransformId

Source transform ID

availableOperations(self) List[QgsCoordinateOperationWidget.OperationDetails]

Returns a list of the available operations shown in the widget.

Return type:

List[QgsCoordinateOperationWidget.OperationDetails]

defaultOperation(self) QgsCoordinateOperationWidget.OperationDetails[source]

Returns the details of the default operation suggested by the widget.

Return type:

QgsCoordinateOperationWidget.OperationDetails

destinationCrs(self) QgsCoordinateReferenceSystem[source]

Returns the destination CRS for the operations shown in the widget.

See also

sourceCrs()

Return type:

QgsCoordinateReferenceSystem

hasSelection(self) bool[source]

Returns True if there is a valid selection in the widget.

Return type:

bool

makeDefaultSelected(self) bool[source]

Returns True if the “make default” option is selected.

Return type:

bool

signal operationChanged[source]

Emitted when the operation selected in the dialog is changed.

signal operationDoubleClicked[source]

Emitted when an operation is double-clicked in the widget.

selectedOperation(self) QgsCoordinateOperationWidget.OperationDetails[source]

Returns the details of the operation currently selected within the widget.

Return type:

QgsCoordinateOperationWidget.OperationDetails

setDestinationCrs(self, crs: QgsCoordinateReferenceSystem)[source]

Sets the destination crs for the operations shown in the widget.

See also

destinationCrs()

See also

setSourceCrs()

Parameters:

crs (QgsCoordinateReferenceSystem)

setMapCanvas(self, canvas: QgsMapCanvas | None)[source]

Sets a map canvas to link to the widget, which allows the widget’s choices to reflect the current canvas state.

Parameters:

canvas (Optional[QgsMapCanvas])

setSelectedOperation(self, operation: QgsCoordinateOperationWidget.OperationDetails)[source]

Sets the details of the operation currently selected within the widget.

Parameters:

operation (QgsCoordinateOperationWidget.OperationDetails)

setSelectedOperationUsingContext(self, context: QgsCoordinateTransformContext)[source]

Automatically sets the selected operation using the settings encapsulated in a transform context.

If no matching operations are found within the context then the defaultOperation() will be selected.

Parameters:

context (QgsCoordinateTransformContext)

setShowFallbackOption(self, visible: bool)[source]

Sets whether the “allow fallback” operations option is visible.

Added in version 3.12.

Parameters:

visible (bool)

setShowMakeDefault(self, show: bool)[source]

Sets whether the “make default” checkbox should be shown.

Parameters:

show (bool)

setSourceCrs(self, crs: QgsCoordinateReferenceSystem)[source]

Sets the source crs for the operations shown in the widget.

See also

sourceCrs()

Parameters:

crs (QgsCoordinateReferenceSystem)

sourceCrs(self) QgsCoordinateReferenceSystem[source]

Returns the source CRS for the operations shown in the widget.

See also

setSourceCrs()

See also

destinationCrs()

Return type:

QgsCoordinateReferenceSystem