Skip to content

Commit 32b6599

Browse files
authored
Merge pull request #9074 from m-kuhn/til
Deprecate QgsGeometry::set for usage in Python
2 parents 6c1036c + 2400050 commit 32b6599

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

python/core/auto_generated/geometry/qgsgeometry.sip.in

+7-1
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,20 @@ and a deep copy. Where possible, use constGet() instead.
125125
.. versionadded:: 3.0
126126
%End
127127

128-
void set( QgsAbstractGeometry *geometry /Transfer/ );
128+
void set( QgsAbstractGeometry *geometry /Transfer/ ) /Deprecated/;
129129
%Docstring
130130
Sets the underlying geometry store. Ownership of geometry is transferred.
131131

132132
.. note::
133133

134134
In QGIS 2.x this method was named setGeometry().
135135

136+
.. note::
137+
138+
This method is deprecated for usage in Python and will be removed from Python bindings with QGIS 4.
139+
Using this method will confuse Python's memory management and type information system.
140+
Better create a new QgsGeometry object instead.
141+
136142
.. seealso:: :py:func:`get`
137143

138144
.. seealso:: :py:func:`constGet`

src/core/geometry/qgsgeometry.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,15 @@ class CORE_EXPORT QgsGeometry
196196
* Sets the underlying geometry store. Ownership of geometry is transferred.
197197
*
198198
* \note In QGIS 2.x this method was named setGeometry().
199+
* \note This method is deprecated for usage in Python and will be removed from Python bindings with QGIS 4.
200+
* Using this method will confuse Python's memory management and type information system.
201+
* Better create a new QgsGeometry object instead.
199202
*
200203
* \see get()
201204
* \see constGet()
202205
* \since QGIS 3.0
203206
*/
204-
void set( QgsAbstractGeometry *geometry SIP_TRANSFER );
207+
void set( QgsAbstractGeometry *geometry SIP_TRANSFER ) SIP_DEPRECATED;
205208

206209
/**
207210
* Returns true if the geometry is null (ie, contains no underlying geometry

0 commit comments

Comments
 (0)