@@ -444,6 +444,20 @@ void PythonQt::qObjectNoLongerWrappedCB(QObject* o)
444444 };
445445}
446446
447+ void PythonQt::setQObjectMissingAttributeCallback (PythonQtQObjectMissingAttributeCB* cb)
448+ {
449+ _self->_p ->_qObjectMissingAttribCB = cb;
450+ }
451+
452+ QString PythonQt::qObjectMissingAttributeCallback (QObject* o, const QString& attribute)
453+ {
454+ if (_self && _self->_p && _self->_p ->_qObjectMissingAttribCB ) {
455+ return _self->_p ->_qObjectMissingAttribCB (o, attribute);
456+ } else {
457+ return QString ();
458+ }
459+ }
460+
447461void PythonQt::registerClass (const QMetaObject* metaobject, const char * package, PythonQtQObjectCreatorFunctionCB* wrapperCreator, PythonQtShellSetInstanceWrapperCB* shell)
448462{
449463 _p->registerClass (metaobject, package, wrapperCreator, shell);
@@ -1095,7 +1109,7 @@ QStringList PythonQt::introspection(PyObject* module, const QString& objectname,
10951109 if (object) {
10961110 results = introspectObject (object, type);
10971111 }
1098-
1112+ PyErr_Clear ();
10991113 return results;
11001114}
11011115
@@ -1216,6 +1230,7 @@ QStringList PythonQt::introspectObject(PyObject* object, ObjectType type)
12161230 Py_DECREF (keys);
12171231 }
12181232 }
1233+ PyErr_Clear ();
12191234 return results;
12201235}
12211236
@@ -1243,6 +1258,7 @@ PyObject* PythonQt::getObjectByType(const QString& typeName)
12431258 }
12441259 }
12451260
1261+ PyErr_Clear ();
12461262 return object;
12471263}
12481264
@@ -1270,6 +1286,7 @@ QStringList PythonQt::introspectType(const QString& typeName, ObjectType type)
12701286 results = introspectObject (object, type);
12711287 Py_DECREF (object);
12721288 }
1289+ PyErr_Clear ();
12731290 return results;
12741291}
12751292
@@ -1403,6 +1420,7 @@ PythonQtPrivate::PythonQtPrivate()
14031420 _defaultImporter = new PythonQtQFileImporter;
14041421 _noLongerWrappedCB = NULL ;
14051422 _wrappedCB = NULL ;
1423+ _qObjectMissingAttribCB = NULL ;
14061424 _currentClassInfoForClassWrapperCreation = NULL ;
14071425 _profilingCB = NULL ;
14081426 _hadError = false ;
0 commit comments