Skip to content

Commit

Permalink
Merge branch 'qgis:master' into nom_countrycodes
Browse files Browse the repository at this point in the history
  • Loading branch information
uprel authored Feb 21, 2025
2 parents 9d6b3d6 + f38d190 commit 138546e
Show file tree
Hide file tree
Showing 19 changed files with 684 additions and 148 deletions.
62 changes: 54 additions & 8 deletions python/PyQt6/core/auto_generated/qgsattributes.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ typedef QMap<int, QString> QgsFieldNameMap;
typedef QMap<int, QgsField> QgsFieldMap;




typedef QVector<QVariant> QgsAttributes;

%MappedType QgsAttributes
Expand All @@ -39,14 +41,60 @@ typedef QVector<QVariant> QgsAttributes;
// Set the list elements.
for ( int i = 0; i < sipCpp->size(); ++i )
{
QVariant *v = new QVariant( sipCpp->at( i ) );
PyObject *tobj;

if ( ( tobj = sipConvertFromNewType( v, sipType_QVariant, Py_None ) ) == NULL )
const QVariant v = sipCpp->at( i );
PyObject *tobj = NULL;
// QByteArray null handling is "special"! See null_from_qvariant_converter in conversions.sip
if ( QgsVariantUtils::isNull( v, true ) && v.userType() != QMetaType::Type::QByteArray )
{
Py_INCREF( Py_None );
tobj = Py_None;
}
else
{
switch ( v.userType() )
{
case QMetaType::Type::Int:
tobj = PyLong_FromLong( v.toInt() );
break;

case QMetaType::Type::UInt:
tobj = PyLong_FromUnsignedLong( v.toUInt() );
break;

case QMetaType::Type::Long:
case QMetaType::Type::LongLong:
tobj = PyLong_FromLongLong( v.toLongLong() );
break;

case QMetaType::Type::ULong:
case QMetaType::Type::ULongLong:
tobj = PyLong_FromUnsignedLongLong( v.toULongLong() );
break;

case QMetaType::Type::Bool:
tobj = PyBool_FromLong( v.toBool() ? 1 : 0 );
break;

case QMetaType::Type::Float:
case QMetaType::Type::Double:
tobj = PyFloat_FromDouble( v.toDouble() );
break;

case QMetaType::Type::QString:
tobj = PyUnicode_FromString( v.toString().toUtf8().constData() );
break;

default:
{
QVariant *newV = new QVariant( v );
tobj = sipConvertFromNewType( newV, sipType_QVariant, sipTransferObj );
break;
}
}
}
if ( tobj == NULL )
{
Py_DECREF( l );
delete v;

return NULL;
}

Expand Down Expand Up @@ -125,8 +173,6 @@ typedef QVector<QVariant> QgsAttributes;
return sipGetState( sipTransferObj );
%End
};


/************************************************************************
* This file has been generated automatically from *
* *
Expand Down
3 changes: 3 additions & 0 deletions python/PyQt6/core/auto_generated/qgsfeature.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ geometry and a list of field/values attributes.
QgsAttributes attributes = sipCpp->attributes();
PyObject *attrs = sipConvertFromType( &attributes, sipType_QgsAttributes, Py_None );
sipRes = PyObject_GetIter( attrs );
// PyObject_GetIter has added a ref to attrs - we need to decrement the ref from sipConvertFromType,
// so that the garbage collector will delete attrs when the iterator is deleted
Py_DECREF( attrs );
%End


Expand Down
74 changes: 37 additions & 37 deletions python/PyQt6/core/class_map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4202,44 +4202,44 @@ QgsFavoritesItem.removeDirectory: src/core/browser/qgsfavoritesitem.h#L66
QgsFavoritesItem.renameFavorite: src/core/browser/qgsfavoritesitem.h#L71
QgsFavoritesItem.sortKey: src/core/browser/qgsfavoritesitem.h#L76
QgsFavoritesItem: src/core/browser/qgsfavoritesitem.h#L31
QgsFeature.QVariant: src/core/qgsfeature.h#L1235
QgsFeature.__delitem__: src/core/qgsfeature.h#L456
QgsFeature.__delitem__: src/core/qgsfeature.h#L467
QgsFeature.__getitem__: src/core/qgsfeature.h#L231
QgsFeature.__getitem__: src/core/qgsfeature.h#L293
QgsFeature.__hash__: src/core/qgsfeature.h#L479
QgsFeature.QVariant: src/core/qgsfeature.h#L1238
QgsFeature.__delitem__: src/core/qgsfeature.h#L459
QgsFeature.__delitem__: src/core/qgsfeature.h#L470
QgsFeature.__getitem__: src/core/qgsfeature.h#L234
QgsFeature.__getitem__: src/core/qgsfeature.h#L296
QgsFeature.__hash__: src/core/qgsfeature.h#L482
QgsFeature.__iter__: src/core/qgsfeature.h#L74
QgsFeature.__setitem__: src/core/qgsfeature.h#L359
QgsFeature.__setitem__: src/core/qgsfeature.h#L409
QgsFeature.approximateMemoryUsage: src/core/qgsfeature.h#L1229
QgsFeature.attribute: src/core/qgsfeature.h#L1089
QgsFeature.attribute: src/core/qgsfeature.h#L1141
QgsFeature.attributeCount: src/core/qgsfeature.h#L599
QgsFeature.attributeMap: src/core/qgsfeature.h#L572
QgsFeature.attributes: src/core/qgsfeature.h#L545
QgsFeature.clearGeometry: src/core/qgsfeature.h#L881
QgsFeature.deleteAttribute: src/core/qgsfeature.h#L1033
QgsFeature.deleteAttribute: src/core/qgsfeature.h#L781
QgsFeature.embeddedSymbol: src/core/qgsfeature.h#L1198
QgsFeature.fieldNameIndex: src/core/qgsfeature.h#L1218
QgsFeature.fields: src/core/qgsfeature.h#L895
QgsFeature.geometry: src/core/qgsfeature.h#L824
QgsFeature.hasGeometry: src/core/qgsfeature.h#L816
QgsFeature.id: src/core/qgsfeature.h#L517
QgsFeature.initAttributes: src/core/qgsfeature.h#L720
QgsFeature.isUnsetValue: src/core/qgsfeature.h#L1177
QgsFeature.isValid: src/core/qgsfeature.h#L801
QgsFeature.padAttributes: src/core/qgsfeature.h#L743
QgsFeature.resizeAttributes: src/core/qgsfeature.h#L735
QgsFeature.setAttribute: src/core/qgsfeature.h#L658
QgsFeature.setAttribute: src/core/qgsfeature.h#L942
QgsFeature.setAttributes: src/core/qgsfeature.h#L617
QgsFeature.setEmbeddedSymbol: src/core/qgsfeature.h#L1207
QgsFeature.setFields: src/core/qgsfeature.h#L889
QgsFeature.setGeometry: src/core/qgsfeature.h#L835
QgsFeature.setGeometry: src/core/qgsfeature.h#L870
QgsFeature.setId: src/core/qgsfeature.h#L527
QgsFeature.setValid: src/core/qgsfeature.h#L810
QgsFeature.__setitem__: src/core/qgsfeature.h#L362
QgsFeature.__setitem__: src/core/qgsfeature.h#L412
QgsFeature.approximateMemoryUsage: src/core/qgsfeature.h#L1232
QgsFeature.attribute: src/core/qgsfeature.h#L1092
QgsFeature.attribute: src/core/qgsfeature.h#L1144
QgsFeature.attributeCount: src/core/qgsfeature.h#L602
QgsFeature.attributeMap: src/core/qgsfeature.h#L575
QgsFeature.attributes: src/core/qgsfeature.h#L548
QgsFeature.clearGeometry: src/core/qgsfeature.h#L884
QgsFeature.deleteAttribute: src/core/qgsfeature.h#L1036
QgsFeature.deleteAttribute: src/core/qgsfeature.h#L784
QgsFeature.embeddedSymbol: src/core/qgsfeature.h#L1201
QgsFeature.fieldNameIndex: src/core/qgsfeature.h#L1221
QgsFeature.fields: src/core/qgsfeature.h#L898
QgsFeature.geometry: src/core/qgsfeature.h#L827
QgsFeature.hasGeometry: src/core/qgsfeature.h#L819
QgsFeature.id: src/core/qgsfeature.h#L520
QgsFeature.initAttributes: src/core/qgsfeature.h#L723
QgsFeature.isUnsetValue: src/core/qgsfeature.h#L1180
QgsFeature.isValid: src/core/qgsfeature.h#L804
QgsFeature.padAttributes: src/core/qgsfeature.h#L746
QgsFeature.resizeAttributes: src/core/qgsfeature.h#L738
QgsFeature.setAttribute: src/core/qgsfeature.h#L661
QgsFeature.setAttribute: src/core/qgsfeature.h#L945
QgsFeature.setAttributes: src/core/qgsfeature.h#L620
QgsFeature.setEmbeddedSymbol: src/core/qgsfeature.h#L1210
QgsFeature.setFields: src/core/qgsfeature.h#L892
QgsFeature.setGeometry: src/core/qgsfeature.h#L838
QgsFeature.setGeometry: src/core/qgsfeature.h#L873
QgsFeature.setId: src/core/qgsfeature.h#L530
QgsFeature.setValid: src/core/qgsfeature.h#L813
QgsFeature: src/core/qgsfeature.h#L57
QgsFeatureFilterModel.QgsFeatureFilterModel: src/core/qgsfeaturefiltermodel.h#L48
QgsFeatureFilterModel.extraIdentifierValues: src/core/qgsfeaturefiltermodel.h#L85
Expand Down
69 changes: 62 additions & 7 deletions python/core/auto_generated/qgsattributes.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ typedef QMap<int, QString> QgsFieldNameMap;
typedef QMap<int, QgsField> QgsFieldMap;



typedef QVector<QVariant> QgsAttributes;

%MappedType QgsAttributes
Expand All @@ -39,14 +40,69 @@ typedef QVector<QVariant> QgsAttributes;
// Set the list elements.
for ( int i = 0; i < sipCpp->size(); ++i )
{
QVariant *v = new QVariant( sipCpp->at( i ) );
PyObject *tobj;

if ( ( tobj = sipConvertFromNewType( v, sipType_QVariant, Py_None ) ) == NULL )
const QVariant v = sipCpp->at( i );
PyObject *tobj = NULL;
if ( !v.isValid() )
{
Py_INCREF( Py_None );
tobj = Py_None;
}
// QByteArray null handling is "special"! See null_from_qvariant_converter in conversions.sip
else if ( QgsVariantUtils::isNull( v, true ) && v.userType() != QMetaType::Type::QByteArray )
{
PyObject *vartype = sipConvertFromEnum( v.type(), sipType_QVariant_Type );
PyObject *args = PyTuple_Pack( 1, vartype );
PyTypeObject *typeObj = sipTypeAsPyTypeObject( sipType_QVariant );
tobj = PyObject_Call( ( PyObject * )typeObj, args, nullptr );
Py_DECREF( args );
Py_DECREF( vartype );
}
else
{
switch ( v.userType() )
{
case QMetaType::Type::Int:
tobj = PyLong_FromLong( v.toInt() );
break;

case QMetaType::Type::UInt:
tobj = PyLong_FromUnsignedLong( v.toUInt() );
break;

case QMetaType::Type::Long:
case QMetaType::Type::LongLong:
tobj = PyLong_FromLongLong( v.toLongLong() );
break;

case QMetaType::Type::ULong:
case QMetaType::Type::ULongLong:
tobj = PyLong_FromUnsignedLongLong( v.toULongLong() );
break;

case QMetaType::Type::Bool:
tobj = PyBool_FromLong( v.toBool() ? 1 : 0 );
break;

case QMetaType::Type::Float:
case QMetaType::Type::Double:
tobj = PyFloat_FromDouble( v.toDouble() );
break;

case QMetaType::Type::QString:
tobj = PyUnicode_FromString( v.toString().toUtf8().constData() );
break;

default:
{
QVariant *newV = new QVariant( v );
tobj = sipConvertFromNewType( newV, sipType_QVariant, sipTransferObj );
break;
}
}
}
if ( tobj == NULL )
{
Py_DECREF( l );
delete v;

return NULL;
}

Expand Down Expand Up @@ -126,7 +182,6 @@ typedef QVector<QVariant> QgsAttributes;
%End
};


/************************************************************************
* This file has been generated automatically from *
* *
Expand Down
3 changes: 3 additions & 0 deletions python/core/auto_generated/qgsfeature.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ geometry and a list of field/values attributes.
QgsAttributes attributes = sipCpp->attributes();
PyObject *attrs = sipConvertFromType( &attributes, sipType_QgsAttributes, Py_None );
sipRes = PyObject_GetIter( attrs );
// PyObject_GetIter has added a ref to attrs - we need to decrement the ref from sipConvertFromType,
// so that the garbage collector will delete attrs when the iterator is deleted
Py_DECREF( attrs );
%End

SIP_PYOBJECT __getitem__( int key ) /HoldGIL/;
Expand Down
74 changes: 37 additions & 37 deletions python/core/class_map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4202,44 +4202,44 @@ QgsFavoritesItem.removeDirectory: src/core/browser/qgsfavoritesitem.h#L66
QgsFavoritesItem.renameFavorite: src/core/browser/qgsfavoritesitem.h#L71
QgsFavoritesItem.sortKey: src/core/browser/qgsfavoritesitem.h#L76
QgsFavoritesItem: src/core/browser/qgsfavoritesitem.h#L31
QgsFeature.QVariant: src/core/qgsfeature.h#L1235
QgsFeature.__delitem__: src/core/qgsfeature.h#L456
QgsFeature.__delitem__: src/core/qgsfeature.h#L467
QgsFeature.__getitem__: src/core/qgsfeature.h#L155
QgsFeature.__getitem__: src/core/qgsfeature.h#L84
QgsFeature.__hash__: src/core/qgsfeature.h#L479
QgsFeature.QVariant: src/core/qgsfeature.h#L1238
QgsFeature.__delitem__: src/core/qgsfeature.h#L459
QgsFeature.__delitem__: src/core/qgsfeature.h#L470
QgsFeature.__getitem__: src/core/qgsfeature.h#L158
QgsFeature.__getitem__: src/core/qgsfeature.h#L87
QgsFeature.__hash__: src/core/qgsfeature.h#L482
QgsFeature.__iter__: src/core/qgsfeature.h#L74
QgsFeature.__setitem__: src/core/qgsfeature.h#L359
QgsFeature.__setitem__: src/core/qgsfeature.h#L409
QgsFeature.approximateMemoryUsage: src/core/qgsfeature.h#L1229
QgsFeature.attribute: src/core/qgsfeature.h#L1089
QgsFeature.attribute: src/core/qgsfeature.h#L1141
QgsFeature.attributeCount: src/core/qgsfeature.h#L599
QgsFeature.attributeMap: src/core/qgsfeature.h#L572
QgsFeature.attributes: src/core/qgsfeature.h#L545
QgsFeature.clearGeometry: src/core/qgsfeature.h#L881
QgsFeature.deleteAttribute: src/core/qgsfeature.h#L1033
QgsFeature.deleteAttribute: src/core/qgsfeature.h#L781
QgsFeature.embeddedSymbol: src/core/qgsfeature.h#L1198
QgsFeature.fieldNameIndex: src/core/qgsfeature.h#L1218
QgsFeature.fields: src/core/qgsfeature.h#L895
QgsFeature.geometry: src/core/qgsfeature.h#L824
QgsFeature.hasGeometry: src/core/qgsfeature.h#L816
QgsFeature.id: src/core/qgsfeature.h#L517
QgsFeature.initAttributes: src/core/qgsfeature.h#L720
QgsFeature.isUnsetValue: src/core/qgsfeature.h#L1177
QgsFeature.isValid: src/core/qgsfeature.h#L801
QgsFeature.padAttributes: src/core/qgsfeature.h#L743
QgsFeature.resizeAttributes: src/core/qgsfeature.h#L735
QgsFeature.setAttribute: src/core/qgsfeature.h#L658
QgsFeature.setAttribute: src/core/qgsfeature.h#L942
QgsFeature.setAttributes: src/core/qgsfeature.h#L617
QgsFeature.setEmbeddedSymbol: src/core/qgsfeature.h#L1207
QgsFeature.setFields: src/core/qgsfeature.h#L889
QgsFeature.setGeometry: src/core/qgsfeature.h#L835
QgsFeature.setGeometry: src/core/qgsfeature.h#L870
QgsFeature.setId: src/core/qgsfeature.h#L527
QgsFeature.setValid: src/core/qgsfeature.h#L810
QgsFeature.__setitem__: src/core/qgsfeature.h#L362
QgsFeature.__setitem__: src/core/qgsfeature.h#L412
QgsFeature.approximateMemoryUsage: src/core/qgsfeature.h#L1232
QgsFeature.attribute: src/core/qgsfeature.h#L1092
QgsFeature.attribute: src/core/qgsfeature.h#L1144
QgsFeature.attributeCount: src/core/qgsfeature.h#L602
QgsFeature.attributeMap: src/core/qgsfeature.h#L575
QgsFeature.attributes: src/core/qgsfeature.h#L548
QgsFeature.clearGeometry: src/core/qgsfeature.h#L884
QgsFeature.deleteAttribute: src/core/qgsfeature.h#L1036
QgsFeature.deleteAttribute: src/core/qgsfeature.h#L784
QgsFeature.embeddedSymbol: src/core/qgsfeature.h#L1201
QgsFeature.fieldNameIndex: src/core/qgsfeature.h#L1221
QgsFeature.fields: src/core/qgsfeature.h#L898
QgsFeature.geometry: src/core/qgsfeature.h#L827
QgsFeature.hasGeometry: src/core/qgsfeature.h#L819
QgsFeature.id: src/core/qgsfeature.h#L520
QgsFeature.initAttributes: src/core/qgsfeature.h#L723
QgsFeature.isUnsetValue: src/core/qgsfeature.h#L1180
QgsFeature.isValid: src/core/qgsfeature.h#L804
QgsFeature.padAttributes: src/core/qgsfeature.h#L746
QgsFeature.resizeAttributes: src/core/qgsfeature.h#L738
QgsFeature.setAttribute: src/core/qgsfeature.h#L661
QgsFeature.setAttribute: src/core/qgsfeature.h#L945
QgsFeature.setAttributes: src/core/qgsfeature.h#L620
QgsFeature.setEmbeddedSymbol: src/core/qgsfeature.h#L1210
QgsFeature.setFields: src/core/qgsfeature.h#L892
QgsFeature.setGeometry: src/core/qgsfeature.h#L838
QgsFeature.setGeometry: src/core/qgsfeature.h#L873
QgsFeature.setId: src/core/qgsfeature.h#L530
QgsFeature.setValid: src/core/qgsfeature.h#L813
QgsFeature: src/core/qgsfeature.h#L57
QgsFeatureFilterModel.QgsFeatureFilterModel: src/core/qgsfeaturefiltermodel.h#L48
QgsFeatureFilterModel.extraIdentifierValues: src/core/qgsfeaturefiltermodel.h#L85
Expand Down
Loading

0 comments on commit 138546e

Please sign in to comment.