Class: QgsExtentGroupBox

class qgis.gui.QgsExtentGroupBox

Bases: QgsCollapsibleGroupBox

Collapsible group box for configuration of extent, typically for a save operation.

Besides allowing the user to enter the extent manually, it comes with options to use original extent or extent defined by the current view in map canvas.

When using the group box, make sure to call setOriginalExtent(), setCurrentExtent() and setOutputCrs() during initialization.

See also

QgsExtentWidget

New in version 2.4.

QgsExtentGroupBox(parent: QWidget = None) Constructor for QgsExtentGroupBox.

Methods

actionEvent

changeEvent

childEvent

clearModifiers

closeEvent

collapseExpandFixes

Visual fixes for when group box is collapsed/expanded

connectNotify

contextMenuEvent

create

currentCrs

Returns the coordinate reference system for the current extent set for the widget.

currentExtent

Returns the current extent set for the widget.

customEvent

destroy

disconnectNotify

dragEnterEvent

dragLeaveEvent

dragMoveEvent

dropEvent

enterEvent

event

extentState

Returns the currently selected state for the widget’s extent.

focusInEvent

focusNextChild

focusNextPrevChild

focusOutEvent

focusPreviousChild

hideEvent

init

initPainter

initStyleOption

inputMethodEvent

isSignalConnected

keyPressEvent

keyReleaseEvent

leaveEvent

loadState

Will load the collapsed and checked state

metric

mouseDoubleClickEvent

mouseMoveEvent

mousePressEvent

mouseReleaseEvent

moveEvent

nativeEvent

originalCrs

Returns the original coordinate reference system set for the widget.

originalExtent

Returns the original extent set for the widget.

outputCrs

Returns the current output CRS, used in the display.

outputExtent

Returns the extent shown in the widget - in output CRS coordinates.

paintEvent

ratio

Returns the current fixed aspect ratio to be used when dragging extent onto the canvas.

receivers

resizeEvent

saveKey

saveState

Will save the collapsed and checked state

sender

senderSignalIndex

setCurrentExtent

Sets the current extent to show in the widget - should be called as part of initialization (or whenever current extent changes).

setMapCanvas

Sets the map canvas to enable dragging of extent on a canvas.

setOriginalExtent

Sets the original extent and coordinate reference system for the widget.

setOutputCrs

Sets the output CRS - may need to be used for transformation from original/current extent.

setOutputExtentFromCurrent

Sets the output extent to be the same as current extent (may be transformed to output CRS).

setOutputExtentFromDrawOnCanvas

Sets the output extent by dragging on the canvas.

setOutputExtentFromLayer

Sets the output extent to match a layer’s extent (may be transformed to output CRS).

setOutputExtentFromOriginal

Sets the output extent to be the same as original extent (may be transformed to output CRS).

setOutputExtentFromUser

Sets the output extent to a custom extent (may be transformed to output CRS).

setRatio

Sets a fixed aspect ratio to be used when dragging extent onto the canvas.

setTitleBase

Sets the base part of title of the group box (will be appended with extent state)

sharedPainter

showEvent

tabletEvent

timerEvent

titleBase

Returns the base part of title of the group box (will be appended with extent state).

titleRect

updateMicroFocus

updateStyle

wheelEvent

Signals

extentChanged

Emitted when the widget’s extent is changed.

Attributes

CurrentExtent

DrawOnCanvas

OriginalExtent

ProjectLayerExtent

UserExtent

CurrentExtent = 1
DrawOnCanvas = 4
class ExtentState

Bases: int

OriginalExtent = 0
ProjectLayerExtent = 3
UserExtent = 2
actionEvent(self, QActionEvent)
changeEvent(self, event: QEvent)
childEvent(self, QChildEvent)
clearModifiers(self)
closeEvent(self, QCloseEvent)
collapseExpandFixes(self)

Visual fixes for when group box is collapsed/expanded

connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
create(self, window: sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
currentCrs(self) QgsCoordinateReferenceSystem

Returns the coordinate reference system for the current extent set for the widget. The current extent and CRS usually reflects the map canvas extent and CRS.

See also

currentExtent()

Return type

QgsCoordinateReferenceSystem

currentExtent(self) QgsRectangle

Returns the current extent set for the widget. The current extent is usually set to match the current map canvas extent.

See also

currentCrs()

Return type

QgsRectangle

customEvent(self, QEvent)
destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
disconnectNotify(self, QMetaMethod)
dragEnterEvent(self, QDragEnterEvent)
dragLeaveEvent(self, QDragLeaveEvent)
dragMoveEvent(self, QDragMoveEvent)
dropEvent(self, QDropEvent)
enterEvent(self, QEvent)
event(self, QEvent) bool
extentChanged

Emitted when the widget’s extent is changed. [signal]

Parameters

r (QgsRectangle) –

extentState(self) QgsExtentGroupBox.ExtentState

Returns the currently selected state for the widget’s extent.

Return type

QgsExtentGroupBox.ExtentState

focusInEvent(self, QFocusEvent)
focusNextChild(self) bool
focusNextPrevChild(self, bool) bool
focusOutEvent(self, QFocusEvent)
focusPreviousChild(self) bool
hideEvent(self, QHideEvent)
init(self)
initPainter(self, QPainter)
initStyleOption(self, QStyleOptionGroupBox)
inputMethodEvent(self, QInputMethodEvent)
isSignalConnected(self, QMetaMethod) bool
keyPressEvent(self, QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
leaveEvent(self, QEvent)
loadState(self)

Will load the collapsed and checked state

The configuration path from which it is loaded is defined by

  • The object name

  • The settingGroup

metric(self, QPaintDevice.PaintDeviceMetric) int
mouseDoubleClickEvent(self, QMouseEvent)
mouseMoveEvent(self, QMouseEvent)
mousePressEvent(self, event: QMouseEvent)
mouseReleaseEvent(self, event: QMouseEvent)
moveEvent(self, QMoveEvent)
nativeEvent(self, Union[QByteArray, bytes, bytearray], sip.voidptr) Tuple[bool, int]
originalCrs(self) QgsCoordinateReferenceSystem

Returns the original coordinate reference system set for the widget.

See also

originalExtent()

Return type

QgsCoordinateReferenceSystem

originalExtent(self) QgsRectangle

Returns the original extent set for the widget.

See also

originalCrs()

Return type

QgsRectangle

outputCrs(self) QgsCoordinateReferenceSystem

Returns the current output CRS, used in the display.

See also

outputExtent()

New in version 3.0.

Return type

QgsCoordinateReferenceSystem

outputExtent(self) QgsRectangle

Returns the extent shown in the widget - in output CRS coordinates.

See also

outputCrs()

Return type

QgsRectangle

paintEvent(self, QPaintEvent)
ratio(self) QSize

Returns the current fixed aspect ratio to be used when dragging extent onto the canvas. If the aspect ratio isn’t fixed, the width and height will be set to zero.

New in version 3.0.

Return type

QSize

receivers(self, PYQT_SIGNAL) int
resizeEvent(self, QResizeEvent)
saveKey(self) str
saveState(self)

Will save the collapsed and checked state

The configuration path to which it is saved is defined by

  • The object name

  • The settingGroup

sender(self) QObject
senderSignalIndex(self) int
setCurrentExtent(self, currentExtent: QgsRectangle, currentCrs: QgsCoordinateReferenceSystem)

Sets the current extent to show in the widget - should be called as part of initialization (or whenever current extent changes). The current extent is usually set to match the current map canvas extent.

See also

currentExtent()

See also

currentCrs()

Parameters
setMapCanvas(self, canvas: QgsMapCanvas, drawOnCanvasOption: bool = True)

Sets the map canvas to enable dragging of extent on a canvas.

Parameters
  • canvas (QgsMapCanvas) – the map canvas

  • drawOnCanvasOption (bool = True) – set to false to disable to draw on canvas option

New in version 3.0.

setOriginalExtent(self, originalExtent: QgsRectangle, originalCrs: QgsCoordinateReferenceSystem)

Sets the original extent and coordinate reference system for the widget. This should be called as part of initialization.

See also

originalExtent()

See also

originalCrs()

Parameters
setOutputCrs(self, outputCrs: QgsCoordinateReferenceSystem)

Sets the output CRS - may need to be used for transformation from original/current extent. Should be called as part of initialization and whenever the the output CRS is changed. The current extent will be reprojected into the new output CRS.

Parameters

outputCrs (QgsCoordinateReferenceSystem) –

setOutputExtentFromCurrent(self)

Sets the output extent to be the same as current extent (may be transformed to output CRS).

setOutputExtentFromDrawOnCanvas(self)

Sets the output extent by dragging on the canvas.

New in version 3.0.

setOutputExtentFromLayer(self, layer: QgsMapLayer)

Sets the output extent to match a layer’s extent (may be transformed to output CRS).

New in version 3.0.

Parameters

layer (QgsMapLayer) –

setOutputExtentFromOriginal(self)

Sets the output extent to be the same as original extent (may be transformed to output CRS).

setOutputExtentFromUser(self, extent: QgsRectangle, crs: QgsCoordinateReferenceSystem)

Sets the output extent to a custom extent (may be transformed to output CRS).

Parameters
setRatio(self, ratio: QSize)

Sets a fixed aspect ratio to be used when dragging extent onto the canvas. To unset a fixed aspect ratio, set the width and height to zero.

Parameters

ratio (QSize) – aspect ratio’s width and height

New in version 3.0.

setTitleBase(self, title: str)

Sets the base part of title of the group box (will be appended with extent state)

See also

titleBase()

New in version 2.12.

Parameters

title (str) –

sharedPainter(self) QPainter
showEvent(self, event: QShowEvent)
tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)
titleBase(self) str

Returns the base part of title of the group box (will be appended with extent state).

See also

setTitleBase()

New in version 2.12.

Return type

str

titleRect(self) QRect
updateMicroFocus(self)
updateStyle(self)
wheelEvent(self, QWheelEvent)