51 Commits

Author SHA1 Message Date
Nyall Dawson
3f6b490218 Sipify 2025-04-02 11:11:10 +10:00
Nyall Dawson
a363ed1862 Fix leak when directly iterating feature in PyQGIS
Fixes #32944
2025-02-22 05:23:15 +10:00
Nyall Dawson
bc52832b47 Lazily hack around markdown title underline not being long enough
Causes a bunch of warnings when building the PyQGIS docs
2024-08-28 11:58:21 +10:00
Nyall Dawson
3a578d6712 Header update 2024-08-13 20:28:55 +10:00
Nyall Dawson
be8dce7d0d Valid improvements from new sipify 2024-08-13 20:28:55 +10:00
Nyall Dawson
6f652d251b Drop no-value copy constructor dox 2024-07-25 04:02:55 +10:00
Nyall Dawson
f23caeef50 Leave null QByteArray values as QByteArray() to maintain API
These should probably be returned as None or NULL for consistency,
but let's not break API right now...
2024-06-13 05:59:14 +10:00
Nyall Dawson
fb30022bca Maintain API 2024-06-13 05:59:14 +10:00
Nyall Dawson
1a56be8cf8 Faster null conversions 2024-06-13 05:59:14 +10:00
Nyall Dawson
e85583fd7b Optimise QgsFeature __getitem__
Avoid calling expensive sipConvertFromNewType method when feature
attribute is a trivial type
Also avoid a copy of the feature attributes which we don't require
2024-06-13 05:59:14 +10:00
Nyall Dawson
f1c76432d5 Don't copy feature attributes just to get their length
Use attributeCount() directly instead
2024-06-13 05:59:14 +10:00
Nyall Dawson
280cd84652 Add more HoldGIL annotations to cheap methods 2024-05-24 16:34:33 +10:00
Jean Felder
f630efa59c qgsfeature: Optimize __set_item__ python call
This change is similar to the one done for `setAttribute`.
2024-05-23 05:15:16 +10:00
Jean Felder
27ebce6dad qgsfeature: Optimize setAttribute python call
This change is similar to the one introduced in the previous
commit for `QgsAttributes` . The python call of `setAttribute` expects
a `QVariant` as input. sip is able to directly handle `QVariant` but
this allocation can be slow.

In some cases, it is possible to speed-up the `setAttribute` call by
checking the type of the attribute. If the attribute is a boolean, an
integer, a float or a string, it is possible to avoid the intermediate
sip QVariant allocation done by `sipConvertToType`.

Based on some testing, this allows to speed-up a python `setAttribute`
call up to 80%. If the python attribute is already a `QVariant`, then
one get the same time.
2024-05-23 05:15:16 +10:00
Even Rouault
15ea5c46bc
Header files: remove all mentions of '\since QGIS 3.0' 2024-02-18 20:57:23 +01:00
Even Rouault
02caeb9db7
Header files: remove all mentions of '\since QGIS 2.' 2024-02-18 20:46:01 +01:00
Nyall Dawson
28cc55a67c Make sip method code compatible with Qt6 2024-01-23 08:32:38 +01:00
Nyall Dawson
7297f7aa9e Fix PyQGIS documentation for QgsFeature.setAttribute
Fixes #51276
2023-01-03 18:16:45 +10:00
Nyall Dawson
fc0e97ecb7 Add custom hash for QgsFeature
Fixes #49932
2022-09-12 10:07:14 +10:00
Nyall Dawson
26eaa24934 Restore QgsFeature equality operators in Python
These were (accidentally?) ommited in 9050cc14d, and then
incorrectly marked as sip_skip when sipify was first introduced
as a result
2022-08-01 16:56:48 +10:00
Nyall Dawson
618978d8b2 Add QgsFeature::isUnsetValue for testing whether an attribute is an unset value 2022-08-01 12:37:35 +10:00
Nyall Dawson
b97c3991cf Add QgsFeature::attributeMap() method to return feature's attributes
as a field name -> value dictionary
2021-12-03 10:43:15 +10:00
Loïc Bartoletti
6562817f39 QgsFeature::setId improve documentation with a warning. fixes #44898 2021-09-22 17:24:13 +10:00
Nyall Dawson
3c3059c938 Fix code example blocks in QgsFeature documentation 2021-06-25 10:50:04 +10:00
Nyall Dawson
711a615be3 Fix raises sphinx format 2021-06-25 10:50:04 +10:00
Nyall Dawson
bb0dfb6ba3 Doxygen says no 2021-06-10 11:03:43 +10:00
Nyall Dawson
49e48f9383 Better approach to avoid duplicate docs 2021-06-10 11:03:43 +10:00
Nyall Dawson
4ff3f447dc Don't try to insert links in raises blocks in PyQGIS docs
These aren't formatted correctly if we do
2021-06-10 11:03:43 +10:00
Nyall Dawson
8359281012 Fix formatting of exception blocks in PyQGIS docs 2021-06-10 11:03:43 +10:00
Denis Rouzaud
35c557a234 run sipify 2021-05-26 14:30:54 +02:00
Denis Rouzaud
ba8a445850 run sipify 2021-03-22 21:13:52 +01:00
Nyall Dawson
b8b5528297 Add embeddedSymbol getter and setter to QgsFeature
Allows for storing per-feature symbology, e.g. for symbols which
are an innate part of features from a dataset which supports
feature level symbology.
2021-03-06 16:37:46 +10:00
tschmetzer
22026cc642
Add information about matching number of fields condition (#41799) 2021-02-26 06:43:40 +10:00
Nyall Dawson
50b9beaad6 [sipify] Catch more class references and insert :py:class: annotations 2021-01-31 05:41:22 +10:00
Nyall Dawson
df28e637cd Fix see also link 2020-12-14 16:49:48 +10:00
Nyall Dawson
53831c6067 Add some useful methods to resize QgsFeature attributes without clearing existing attributes 2020-12-14 16:49:48 +10:00
Even Rouault
a04fcce548 Add QgsFeature::approximateMemoryUsage() 2020-10-19 09:25:10 +10:00
Alessandro Pasotti
0a4214499d Fix QgsFeature default ctor set fid to 0
The QgsFeature default constructors initialized
feature id to 0, which is a valid feature id
instead of initializing it fo FID_NULL.

This was just wrong and broke the validator for
UNIQUE constraints in case a feature with fid 0
existed in the data provider.

Fixes #36962
2020-06-22 15:22:46 +02:00
Nyall Dawson
81a9db9f57 [sipify] Fix creation of cross references 2020-06-15 13:43:58 +10:00
Nyall Dawson
a5101f2ade [sipify] Fix header formatting 2020-06-13 16:49:14 +10:00
Nyall Dawson
cedd73ee4d More list formatting fixes 2020-06-13 16:49:14 +10:00
Nyall Dawson
9fb02d6ba7 Remove last traces of obsolete Qt4 API usage (from c++ -- may still be some in Python!) 2020-02-08 15:17:47 +10:00
Nyall Dawson
b6d66becab Sipify 2019-02-27 09:41:11 +10:00
Nyall Dawson
5603546c26 Dox 2018-11-21 08:48:55 +11:00
Nyall Dawson
e21ea25c66 Add method to set QgsFeature geometry directly from QgsAbstractGeometry
Allows

    feat.setGeometry(QgsPoint(1,2))

instead of the more obscure

    feat.setGeometry(QgsGeometry(QgsPoint(1,2)))
2018-11-21 08:48:55 +11:00
Matthias Kuhn
74fb0fabc6 Move QgsFeatureId to own header 2018-09-03 07:54:37 +02:00
Denis Rouzaud
65bb60e96c run sipify 2018-05-28 10:39:34 -08:00
Nyall Dawson
38850bdb94 [pyqgis] Ensure that multiline param tags are indented for additional lines 2018-05-27 18:54:09 +10:00
Nyall Dawson
c864d22d1f Add "get ..." to doxygen compliance blacklist
Should be "gets ..." for consistent tense, or better yet
"returns ..." for consistency.
2018-05-27 14:05:06 +10:00
Denis Rouzaud
e8cf8c2f1c [sipify] insert missing QMetaObject for gadget classes 2018-05-15 17:38:16 -04:00