@@ -1015,17 +1015,17 @@ QVariant PythonQtConv::PyObjToQVariant(PyObject* val, int type)
10151015 if (wrap->classInfo ()->isCPPWrapper ()) {
10161016 if (wrap->classInfo ()->metaTypeId ()>0 ) {
10171017 // 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 );
10191019 } else {
10201020 // TODOXXX we could as well check if there is a registered meta type for "classname*", so that we may pass
10211021 // the pointer here...
10221022 // is this worth anything? we loose the knowledge of the cpp object type
1023- v = qVariantFromValue (wrap->_wrappedPtr );
1023+ v = QVariant::fromValue (wrap->_wrappedPtr );
10241024 }
10251025 } else {
10261026 // this gives us a QObject pointer
10271027 QObject* myObject = wrap->_obj ;
1028- v = qVariantFromValue (myObject);
1028+ v = QVariant::fromValue (myObject);
10291029 }
10301030 return v;
10311031 } else if (val == Py_None) {
@@ -1073,55 +1073,55 @@ QVariant PythonQtConv::PyObjToQVariant(PyObject* val, int type)
10731073 case QMetaType::Float:
10741074 {
10751075 float d = (float ) PyObjGetDouble (val,false ,ok);
1076- if (ok) v = qVariantFromValue (d);
1076+ if (ok) v = QVariant::fromValue (d);
10771077 }
10781078 break ;
10791079 case QMetaType::Long:
10801080 {
10811081 long d = (long ) PyObjGetLongLong (val,false ,ok);
1082- if (ok) v = qVariantFromValue (d);
1082+ if (ok) v = QVariant::fromValue (d);
10831083 }
10841084 break ;
10851085 case QMetaType::ULong:
10861086 {
10871087 unsigned long d = (unsigned long ) PyObjGetLongLong (val,false ,ok);
1088- if (ok) v = qVariantFromValue (d);
1088+ if (ok) v = QVariant::fromValue (d);
10891089 }
10901090 break ;
10911091 case QMetaType::LongLong:
10921092 {
10931093 qint64 d = PyObjGetLongLong (val, false , ok);
1094- if (ok) v = qVariantFromValue (d);
1094+ if (ok) v = QVariant::fromValue (d);
10951095 }
10961096 break ;
10971097 case QMetaType::ULongLong:
10981098 {
10991099 quint64 d = PyObjGetULongLong (val, false , ok);
1100- if (ok) v = qVariantFromValue (d);
1100+ if (ok) v = QVariant::fromValue (d);
11011101 }
11021102 break ;
11031103 case QMetaType::Short:
11041104 {
11051105 short d = (short ) PyObjGetInt (val,false ,ok);
1106- if (ok) v = qVariantFromValue (d);
1106+ if (ok) v = QVariant::fromValue (d);
11071107 }
11081108 break ;
11091109 case QMetaType::UShort:
11101110 {
11111111 unsigned short d = (unsigned short ) PyObjGetInt (val,false ,ok);
1112- if (ok) v = qVariantFromValue (d);
1112+ if (ok) v = QVariant::fromValue (d);
11131113 }
11141114 break ;
11151115 case QMetaType::Char:
11161116 {
11171117 char d = (char ) PyObjGetInt (val,false ,ok);
1118- if (ok) v = qVariantFromValue (d);
1118+ if (ok) v = QVariant::fromValue (d);
11191119 }
11201120 break ;
11211121 case QMetaType::UChar:
11221122 {
11231123 unsigned char d = (unsigned char ) PyObjGetInt (val,false ,ok);
1124- if (ok) v = qVariantFromValue (d);
1124+ if (ok) v = QVariant::fromValue (d);
11251125 }
11261126 break ;
11271127
@@ -1189,7 +1189,7 @@ QVariant PythonQtConv::PyObjToQVariant(PyObject* val, int type)
11891189 PythonQtInstanceWrapper* wrap = (PythonQtInstanceWrapper*)val;
11901190 if (wrap->classInfo ()->isCPPWrapper () && wrap->classInfo ()->metaTypeId () == type) {
11911191 // 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 );
11931193 } else {
11941194 // Try to convert the object to a QVariant based on the typeName
11951195 bool ok;
@@ -1202,10 +1202,10 @@ QVariant PythonQtConv::PyObjToQVariant(PyObject* val, int type)
12021202 void * object = castWrapperTo (wrap, typeName, ok);
12031203 if (ok) {
12041204 if (isPtr) {
1205- v = QVariant (type, &object);
1205+ v = QVariant (QMetaType ( type) , &object);
12061206 }
12071207 else {
1208- v = QVariant (type, object);
1208+ v = QVariant (QMetaType ( type) , object);
12091209 }
12101210 }
12111211 }
@@ -1215,7 +1215,7 @@ QVariant PythonQtConv::PyObjToQVariant(PyObject* val, int type)
12151215 PythonQtConvertPythonToMetaTypeCB* converter = _pythonToMetaTypeConverters.value (type);
12161216 if (converter) {
12171217 // allocate a default object of the needed type:
1218- v = QVariant (type, (const void *)nullptr );
1218+ v = QVariant (QMetaType ( type) , (const void *)nullptr );
12191219 // now call the converter, passing the internal object of the variant
12201220 ok = (*converter)(val, (void *)v.constData (), type, true );
12211221 if (!ok) {
@@ -1226,7 +1226,7 @@ QVariant PythonQtConv::PyObjToQVariant(PyObject* val, int type)
12261226 const PythonQtMethodInfo::ParameterInfo& info = PythonQtMethodInfo::getParameterInfoForMetaType (type);
12271227 if (info.isQList && (info.innerNamePointerCount == 1 )) {
12281228 // allocate a default object of the needed type:
1229- v = QVariant (type, (const void *)nullptr );
1229+ v = QVariant (QMetaType ( type) , (const void *)nullptr );
12301230 ok = ConvertPythonListToQListOfPointerType (val, (QList<void *>*)v.constData (), info, true );
12311231 if (!ok) {
12321232 v = QVariant ();
@@ -1461,7 +1461,7 @@ QString PythonQtConv::CPPObjectToString(int type, const void* data) {
14611461 // this creates a copy, but that should not be expensive for typical simple variants
14621462 // (but we do not want to do this for our won user types!
14631463 if (type>0 && type < (int )QVariant::UserType) {
1464- QVariant v (type, data);
1464+ QVariant v (QMetaType ( type) , data);
14651465 r = v.toString ();
14661466 }
14671467 }
@@ -1483,11 +1483,6 @@ PyObject* PythonQtConv::createCopyFromMetaType( int type, const void* data )
14831483 return (PyObject*)wrap;
14841484}
14851485
1486- PyObject* PythonQtConv::convertFromStringRef (const void * inObject, int /* metaTypeId*/ )
1487- {
1488- return PythonQtConv::QStringToPyObject (((QStringRef*)inObject)->toString ());
1489- }
1490-
14911486QByteArray PythonQtConv::getCPPTypeName (PyObject* type)
14921487{
14931488 QByteArray result;
0 commit comments