15 Commits

Author SHA1 Message Date
Nyall Dawson
3f6b490218 Sipify 2025-04-02 11:11:10 +10:00
Nyall Dawson
6d122f0038 Sipify 2025-03-30 20:48:07 +10:00
Julien Cabieces
ed64834106 api(deprecated): add message to deprecated SIP annotation 2024-12-17 09:06:42 +01:00
Alessandro Pasotti
61935ad591 Introduce QgsVariantUtils::isNumericType 2024-10-11 16:14:24 +02:00
Nyall Dawson
ef0289f3ec Fix formatting of Python ..deprecated annotations in docstrings
Fixes https://github.com/qgis/pyqgis-api-docs-builder/issues/174
2024-09-02 11:42:12 +10:00
Nyall Dawson
8b04562ba7 Avoid fragile reg for argument removal 2024-08-14 13:05:46 +10:00
Nyall Dawson
3a578d6712 Header update 2024-08-13 20:28:55 +10:00
Julien Cabieces
ad13ae8b32 fix doc TODO 2024-05-31 08:46:33 +10:00
Julien Cabieces
848fb16785 Add \deprecated tag 2024-05-31 08:46:33 +10:00
Julien Cabieces
97f1c8df97 make python API backward compatible 2024-05-31 08:46:33 +10:00
Julien Cabieces
0ccaf2d299 sipify 2024-05-31 08:46:33 +10:00
Nyall Dawson
ed43556c93 Don't show misleading null in variant warnings when converting objects
for Python

This isn't something we are doing wrong, it's how sip handles these
objects.
2024-02-23 05:41:22 +10:00
Nyall Dawson
3dc17faca6
Add utilities to convert between QMetaType::Type and QVariant::Type
While QVariant::Type can be directly static_cast to QMetaType::Type,
the reverse is not true and many QMetaType::Type values don't
have exact counterparts in QVariant::Type.

So we use the logic:

- If no conversion is possible, QVariant::UserType will be returned.
  Note that we don't use QVariant::Invalid, as the value DOES have
  a type, it's just one which needs special handling (just like user
  types do)
- Some conversions are lossy, in that the QVariant::Type cannot
  represent the full range of values possible in QMetaType::Type.
  In these cases the returned type will be an "expanded" type
  capable of storing the full range of values possible in the
  original type. Eg we map QMetaType::Type::Float to QVariant::Type::Double

QgsVariantUtils::variantTypeToMetaType is included for clarity/
completeness/future proof-ness, even though it currently can
be handled with just a simple static cast.
2024-01-24 09:49:43 +10:00
Nyall Dawson
8171b76ddd Introduce QgsVariantUtils::isNull( QVariant )
This method restores the Qt 5 logic for testing for null variants,
where for core Qt types the isNull check is forwarded to the actual
data type.

E.g. on Qt 5:  QVariant( QDateTime()).isNull() is true, but
on Qt 6 it's false

This breaks a LOT of assumptions made throughout QGIS. The new
helper method avoids this breakage by ensuring we follow the Qt 5
logic also on Qt 6 builds, and also gives us the option to extend
this logic for user types (e.g QVariant( QgsGeometry() ).isNull() could
return true). (That's not included here)
2022-08-20 15:35:09 +10:00
Nyall Dawson
a20f7789d9 Partial work on centralizing all QVariant::Type to display string
logic in a new QgsVariantUtils class

(I've likely missed a few places here, but it's a start!)
2022-01-31 17:24:53 +10:00