@@ -1015,17 +1015,17 @@ QVariant PythonQtConv::PyObjToQVariant(PyObject* val, int type)
1015
1015
if (wrap->classInfo ()->isCPPWrapper ()) {
1016
1016
if (wrap->classInfo ()->metaTypeId ()>0 ) {
1017
1017
// construct a new variant from the C++ object if it has a meta type (this will COPY the object!)
1018
- v = QVariant (wrap->classInfo ()->metaTypeId (), wrap->_wrappedPtr );
1018
+ v = QVariant (QMetaType ( wrap->classInfo ()->metaTypeId () ), wrap->_wrappedPtr );
1019
1019
} else {
1020
1020
// TODOXXX we could as well check if there is a registered meta type for "classname*", so that we may pass
1021
1021
// the pointer here...
1022
1022
// is this worth anything? we loose the knowledge of the cpp object type
1023
- v = qVariantFromValue (wrap->_wrappedPtr );
1023
+ v = QVariant::fromValue (wrap->_wrappedPtr );
1024
1024
}
1025
1025
} else {
1026
1026
// this gives us a QObject pointer
1027
1027
QObject* myObject = wrap->_obj ;
1028
- v = qVariantFromValue (myObject);
1028
+ v = QVariant::fromValue (myObject);
1029
1029
}
1030
1030
return v;
1031
1031
} else if (val == Py_None) {
@@ -1073,55 +1073,55 @@ QVariant PythonQtConv::PyObjToQVariant(PyObject* val, int type)
1073
1073
case QMetaType::Float:
1074
1074
{
1075
1075
float d = (float ) PyObjGetDouble (val,false ,ok);
1076
- if (ok) v = qVariantFromValue (d);
1076
+ if (ok) v = QVariant::fromValue (d);
1077
1077
}
1078
1078
break ;
1079
1079
case QMetaType::Long:
1080
1080
{
1081
1081
long d = (long ) PyObjGetLongLong (val,false ,ok);
1082
- if (ok) v = qVariantFromValue (d);
1082
+ if (ok) v = QVariant::fromValue (d);
1083
1083
}
1084
1084
break ;
1085
1085
case QMetaType::ULong:
1086
1086
{
1087
1087
unsigned long d = (unsigned long ) PyObjGetLongLong (val,false ,ok);
1088
- if (ok) v = qVariantFromValue (d);
1088
+ if (ok) v = QVariant::fromValue (d);
1089
1089
}
1090
1090
break ;
1091
1091
case QMetaType::LongLong:
1092
1092
{
1093
1093
qint64 d = PyObjGetLongLong (val, false , ok);
1094
- if (ok) v = qVariantFromValue (d);
1094
+ if (ok) v = QVariant::fromValue (d);
1095
1095
}
1096
1096
break ;
1097
1097
case QMetaType::ULongLong:
1098
1098
{
1099
1099
quint64 d = PyObjGetULongLong (val, false , ok);
1100
- if (ok) v = qVariantFromValue (d);
1100
+ if (ok) v = QVariant::fromValue (d);
1101
1101
}
1102
1102
break ;
1103
1103
case QMetaType::Short:
1104
1104
{
1105
1105
short d = (short ) PyObjGetInt (val,false ,ok);
1106
- if (ok) v = qVariantFromValue (d);
1106
+ if (ok) v = QVariant::fromValue (d);
1107
1107
}
1108
1108
break ;
1109
1109
case QMetaType::UShort:
1110
1110
{
1111
1111
unsigned short d = (unsigned short ) PyObjGetInt (val,false ,ok);
1112
- if (ok) v = qVariantFromValue (d);
1112
+ if (ok) v = QVariant::fromValue (d);
1113
1113
}
1114
1114
break ;
1115
1115
case QMetaType::Char:
1116
1116
{
1117
1117
char d = (char ) PyObjGetInt (val,false ,ok);
1118
- if (ok) v = qVariantFromValue (d);
1118
+ if (ok) v = QVariant::fromValue (d);
1119
1119
}
1120
1120
break ;
1121
1121
case QMetaType::UChar:
1122
1122
{
1123
1123
unsigned char d = (unsigned char ) PyObjGetInt (val,false ,ok);
1124
- if (ok) v = qVariantFromValue (d);
1124
+ if (ok) v = QVariant::fromValue (d);
1125
1125
}
1126
1126
break ;
1127
1127
@@ -1189,7 +1189,7 @@ QVariant PythonQtConv::PyObjToQVariant(PyObject* val, int type)
1189
1189
PythonQtInstanceWrapper* wrap = (PythonQtInstanceWrapper*)val;
1190
1190
if (wrap->classInfo ()->isCPPWrapper () && wrap->classInfo ()->metaTypeId () == type) {
1191
1191
// construct a new variant from the C++ object if it has the same meta type
1192
- v = QVariant (type, wrap->_wrappedPtr );
1192
+ v = QVariant (QMetaType ( type) , wrap->_wrappedPtr );
1193
1193
} else {
1194
1194
// Try to convert the object to a QVariant based on the typeName
1195
1195
bool ok;
@@ -1202,10 +1202,10 @@ QVariant PythonQtConv::PyObjToQVariant(PyObject* val, int type)
1202
1202
void * object = castWrapperTo (wrap, typeName, ok);
1203
1203
if (ok) {
1204
1204
if (isPtr) {
1205
- v = QVariant (type, &object);
1205
+ v = QVariant (QMetaType ( type) , &object);
1206
1206
}
1207
1207
else {
1208
- v = QVariant (type, object);
1208
+ v = QVariant (QMetaType ( type) , object);
1209
1209
}
1210
1210
}
1211
1211
}
@@ -1215,7 +1215,7 @@ QVariant PythonQtConv::PyObjToQVariant(PyObject* val, int type)
1215
1215
PythonQtConvertPythonToMetaTypeCB* converter = _pythonToMetaTypeConverters.value (type);
1216
1216
if (converter) {
1217
1217
// allocate a default object of the needed type:
1218
- v = QVariant (type, (const void *)nullptr );
1218
+ v = QVariant (QMetaType ( type) , (const void *)nullptr );
1219
1219
// now call the converter, passing the internal object of the variant
1220
1220
ok = (*converter)(val, (void *)v.constData (), type, true );
1221
1221
if (!ok) {
@@ -1226,7 +1226,7 @@ QVariant PythonQtConv::PyObjToQVariant(PyObject* val, int type)
1226
1226
const PythonQtMethodInfo::ParameterInfo& info = PythonQtMethodInfo::getParameterInfoForMetaType (type);
1227
1227
if (info.isQList && (info.innerNamePointerCount == 1 )) {
1228
1228
// allocate a default object of the needed type:
1229
- v = QVariant (type, (const void *)nullptr );
1229
+ v = QVariant (QMetaType ( type) , (const void *)nullptr );
1230
1230
ok = ConvertPythonListToQListOfPointerType (val, (QList<void *>*)v.constData (), info, true );
1231
1231
if (!ok) {
1232
1232
v = QVariant ();
@@ -1461,7 +1461,7 @@ QString PythonQtConv::CPPObjectToString(int type, const void* data) {
1461
1461
// this creates a copy, but that should not be expensive for typical simple variants
1462
1462
// (but we do not want to do this for our won user types!
1463
1463
if (type>0 && type < (int )QVariant::UserType) {
1464
- QVariant v (type, data);
1464
+ QVariant v (QMetaType ( type) , data);
1465
1465
r = v.toString ();
1466
1466
}
1467
1467
}
@@ -1483,11 +1483,6 @@ PyObject* PythonQtConv::createCopyFromMetaType( int type, const void* data )
1483
1483
return (PyObject*)wrap;
1484
1484
}
1485
1485
1486
- PyObject* PythonQtConv::convertFromStringRef (const void * inObject, int /* metaTypeId*/ )
1487
- {
1488
- return PythonQtConv::QStringToPyObject (((QStringRef*)inObject)->toString ());
1489
- }
1490
-
1491
1486
QByteArray PythonQtConv::getCPPTypeName (PyObject* type)
1492
1487
{
1493
1488
QByteArray result;
0 commit comments