Class: QgsGeometryWidget

class qgis.gui.QgsGeometryWidget

Bases: PyQt5.QtWidgets.QWidget

A widget for storing and interacting with a QgsGeometry object.

This widget can be used in places where an dialog needs to expose a geometry value to users, and allow them to safely interact with it (such as changing the stored geometry value).

New in version 3.30.

QgsGeometryWidget(parent: QWidget = None) Constructor for QgsGeometryWidget, with the specified parent widget.

Methods

acceptedWkbTypes

Returns the list of WKB geometry types which are permitted for the widget.

actionEvent

changeEvent

childEvent

clearGeometry

Clears the current geometry value stored in the widget.

closeEvent

connectNotify

contextMenuEvent

copyAsGeoJson

Copies the current geometry value to the clipboard, as a GeoJSON string.

copyAsWkt

Copies the current geometry value to the clipboard, as a WKT string.

create

customEvent

destroy

disconnectNotify

dragEnterEvent

dragLeaveEvent

dragMoveEvent

dropEvent

enterEvent

event

focusInEvent

focusNextChild

focusNextPrevChild

focusOutEvent

focusPreviousChild

geometryValue

Returns the current geometry value for the widget.

hideEvent

initPainter

inputMethodEvent

isReadOnly

Returns whether the widget is in a read-only state.

isSignalConnected

keyPressEvent

keyReleaseEvent

leaveEvent

metric

mouseDoubleClickEvent

mouseMoveEvent

mousePressEvent

mouseReleaseEvent

moveEvent

nativeEvent

paintEvent

receivers

resizeEvent

sender

senderSignalIndex

setAcceptedWkbTypes

Sets the list of WKB geometry types which are permitted for the widget.

setGeometryValue

Sets the current geometry value for the widget.

setReadOnly

Sets whether the widget should be in a read-only state.

sharedPainter

showEvent

tabletEvent

timerEvent

updateMicroFocus

wheelEvent

Signals

geometryValueChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

acceptedWkbTypes(self) List[Qgis.WkbType]

Returns the list of WKB geometry types which are permitted for the widget.

Return type:

List[Qgis.WkbType]

actionEvent(self, QActionEvent)
changeEvent(self, QEvent)
childEvent(self, QChildEvent)
clearGeometry(self)

Clears the current geometry value stored in the widget.

closeEvent(self, QCloseEvent)
connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
copyAsGeoJson(self)

Copies the current geometry value to the clipboard, as a GeoJSON string.

See also

copyAsWkt()

copyAsWkt(self)

Copies the current geometry value to the clipboard, as a WKT string.

See also

copyAsGeoJson()

create(self, window: PyQt5.sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
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
focusInEvent(self, QFocusEvent)
focusNextChild(self) bool
focusNextPrevChild(self, bool) bool
focusOutEvent(self, QFocusEvent)
focusPreviousChild(self) bool
geometryValue(self) QgsReferencedGeometry

Returns the current geometry value for the widget.

Warning

This should not be confused with QWidget.geometry(), which returns the placement and size of the widget itself.

Return type:

QgsReferencedGeometry

geometryValueChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

hideEvent(self, QHideEvent)
initPainter(self, QPainter)
inputMethodEvent(self, QInputMethodEvent)
isReadOnly(self) bool

Returns whether the widget is in a read-only state.

See also

setReadOnly()

Return type:

bool

isSignalConnected(self, QMetaMethod) bool
keyPressEvent(self, QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
leaveEvent(self, QEvent)
metric(self, QPaintDevice.PaintDeviceMetric) int
mouseDoubleClickEvent(self, QMouseEvent)
mouseMoveEvent(self, QMouseEvent)
mousePressEvent(self, QMouseEvent)
mouseReleaseEvent(self, QMouseEvent)
moveEvent(self, QMoveEvent)
nativeEvent(self, Union[QByteArray, bytes, bytearray], PyQt5.sip.voidptr) Tuple[bool, int]
paintEvent(self, QPaintEvent)
receivers(self, PYQT_SIGNAL) int
resizeEvent(self, QResizeEvent)
sender(self) QObject
senderSignalIndex(self) int
setAcceptedWkbTypes(self, types: Iterable[Qgis.WkbType])

Sets the list of WKB geometry types which are permitted for the widget.

Parameters:

types (Iterable[Qgis.WkbType]) –

setGeometryValue(self, geometry: QgsReferencedGeometry)

Sets the current geometry value for the widget.

Warning

This should not be confused with QWidget.setGeometry(), which modifies the placement and size of the widget itself.

See also

geometryValue()

Parameters:

geometry (QgsReferencedGeometry) –

setReadOnly(self, readOnly: bool)

Sets whether the widget should be in a read-only state.

See also

isReadOnly()

Parameters:

readOnly (bool) –

sharedPainter(self) QPainter
showEvent(self, QShowEvent)
tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)
updateMicroFocus(self)
wheelEvent(self, QWheelEvent)