QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
Public Slots | Signals | Public Member Functions | Properties | List of all members
QgsGeometryWidget Class Reference

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

#include <qgsgeometrywidget.h>

Inheritance diagram for QgsGeometryWidget:
Inheritance graph
[legend]

Public Slots

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

Signals

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

Public Member Functions

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

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 42 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 29 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 121 of file qgsgeometrywidget.cpp.

◆ clearGeometry

void QgsGeometryWidget::clearGeometry ( )
slot

Clears the current geometry value stored in the widget.

Definition at line 136 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 152 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 144 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 111 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 126 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 116 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 96 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 131 of file qgsgeometrywidget.cpp.

Property Documentation

◆ geometryValue

QgsReferencedGeometry QgsGeometryWidget::geometryValue
readwrite

Definition at line 42 of file qgsgeometrywidget.h.


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