File tree 1 file changed +16
-12
lines changed
1 file changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -1213,38 +1213,42 @@ template<TYPE2>
1213
1213
if (!d)
1214
1214
return NULL;
1215
1215
1216
- const sipMappedType *qlist_type = sipFindMappedType("QList<TYPE2>");
1217
-
1218
1216
// Set the dictionary elements.
1219
1217
QMap<QString, QList< TYPE2 > >::const_iterator i;
1220
1218
1221
1219
for (i = sipCpp->constBegin(); i != sipCpp->constEnd(); ++i)
1222
1220
{
1223
1221
QString *t1 = new QString(i.key());
1224
-
1225
1222
PyObject *t1obj = sipConvertFromNewType(t1, sipType_QString, sipTransferObj);
1226
1223
1227
- QList< TYPE2 > *t2 = new QList< TYPE2 >( i.value() );
1228
-
1229
- PyObject *t2obj = sipConvertFromMappedType(t2, qlist_type, sipTransferObj);
1224
+ // build list for dictionary value
1225
+ QList< TYPE2 > sourceList = i.value();
1226
+ PyObject *t2list = PyList_New( sourceList.size() );
1227
+ if ( t2list )
1228
+ {
1229
+ for ( int j = 0; j < sourceList.size(); j++ )
1230
+ {
1231
+ TYPE2 *t = new TYPE2(sourceList.at(j));
1232
+ PyObject *lobj = sipConvertFromNewType(t, sipType_TYPE2, sipTransferObj);
1233
+ PyList_SetItem( t2list, j, lobj );
1234
+ }
1235
+ }
1230
1236
1231
- if (t1obj == NULL || t2obj == NULL || PyDict_SetItem(d, t1obj, t2obj ) < 0)
1237
+ if (t1obj == NULL || t2list == NULL || PyDict_SetItem(d, t1obj, t2list ) < 0)
1232
1238
{
1233
1239
Py_DECREF(d);
1234
1240
1235
1241
if (t1obj)
1236
1242
Py_DECREF(t1obj);
1237
1243
1238
- if (t2obj)
1239
- Py_DECREF(t2obj);
1240
- else
1241
- delete t2;
1244
+ if (t2list)
1245
+ Py_DECREF(t2list);
1242
1246
1243
1247
return NULL;
1244
1248
}
1245
1249
1246
1250
Py_DECREF(t1obj);
1247
- Py_DECREF(t2obj );
1251
+ Py_DECREF(t2list );
1248
1252
}
1249
1253
1250
1254
return d;
You can’t perform that action at this time.
0 commit comments