QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
QgsGeometryWidget Class Reference

A widget for storing and interacting with a QgsGeometry object. More...

#include <qgsgeometrywidget.h>

Inheritance diagram for QgsGeometryWidget:

Public Slots

void clearGeometry ()
 Clears the current geometry value stored in the widget.
void copyAsGeoJson ()
 Copies the current geometry value to the clipboard, as a GeoJSON string.
void copyAsWkt ()
 Copies the current geometry value to the clipboard, as a WKT string.
void setReadOnly (bool readOnly)
 Sets whether the widget should be in a read-only state.

Signals

void geometryValueChanged (const QgsReferencedGeometry &value)
 Emitted whenever the geometry value of the widget is changed.

Public Member Functions

 QgsGeometryWidget (QWidget *parent=nullptr)
 Constructor for QgsGeometryWidget, with the specified parent widget.
QList< Qgis::WkbTypeacceptedWkbTypes () const
 Returns the list of WKB geometry types which are permitted for the widget.
QgsReferencedGeometry geometryValue () const
 Returns the current geometry value for the widget.
bool isReadOnly () const
 Returns whether the widget is in a read-only state.
void setAcceptedWkbTypes (const QList< Qgis::WkbType > &types)
 Sets the list of WKB geometry types which are permitted for the widget.
void setGeometryValue (const QgsReferencedGeometry &geometry)
 Sets the current geometry value for the widget.

Properties

QgsReferencedGeometry geometryValue

Detailed Description

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).

Since
QGIS 3.30

Definition at line 41 of file qgsgeometrywidget.h.

Constructor & Destructor Documentation

◆ QgsGeometryWidget()

QgsGeometryWidget::QgsGeometryWidget ( QWidget * parent = nullptr)
explicit

Constructor for QgsGeometryWidget, with the specified parent widget.

Definition at line 33 of file qgsgeometrywidget.cpp.

Member Function Documentation

◆ acceptedWkbTypes()

QList< Qgis::WkbType > QgsGeometryWidget::acceptedWkbTypes ( ) const

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

See also
setAcceptedWkbTypes()

Definition at line 125 of file qgsgeometrywidget.cpp.

◆ clearGeometry

void QgsGeometryWidget::clearGeometry ( )
slot

Clears the current geometry value stored in the widget.

Definition at line 140 of file qgsgeometrywidget.cpp.

◆ copyAsGeoJson

void QgsGeometryWidget::copyAsGeoJson ( )
slot

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

See also
copyAsWkt()

Definition at line 156 of file qgsgeometrywidget.cpp.

◆ copyAsWkt

void QgsGeometryWidget::copyAsWkt ( )
slot

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

See also
copyAsGeoJson()

Definition at line 148 of file qgsgeometrywidget.cpp.

◆ geometryValue()

QgsReferencedGeometry QgsGeometryWidget::geometryValue ( ) const

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.
See also
setGeometryValue()
geometryValueChanged()

Definition at line 115 of file qgsgeometrywidget.cpp.

◆ geometryValueChanged

void QgsGeometryWidget::geometryValueChanged ( const QgsReferencedGeometry & value)
signal

Emitted whenever the geometry value of the widget is changed.

See also
geometryValue()
setGeometryValue()

◆ isReadOnly()

bool QgsGeometryWidget::isReadOnly ( ) const

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

See also
setReadOnly()

Definition at line 130 of file qgsgeometrywidget.cpp.

◆ setAcceptedWkbTypes()

void QgsGeometryWidget::setAcceptedWkbTypes ( const QList< Qgis::WkbType > & types)

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

See also
acceptedWkbTypes()

Definition at line 120 of file qgsgeometrywidget.cpp.

◆ setGeometryValue()

void QgsGeometryWidget::setGeometryValue ( const QgsReferencedGeometry & geometry)

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()
geometryValueChanged()

Definition at line 100 of file qgsgeometrywidget.cpp.

◆ setReadOnly

void QgsGeometryWidget::setReadOnly ( bool readOnly)
slot

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

See also
isReadOnly()

Definition at line 135 of file qgsgeometrywidget.cpp.

Property Documentation

◆ geometryValue

QgsReferencedGeometry QgsGeometryWidget::geometryValue
readwrite

Definition at line 45 of file qgsgeometrywidget.h.


The documentation for this class was generated from the following files: