added support for attribute lookup error callback · githubuser0xFFFF/pythonqt@b7f250b · GitHub
Skip to content

Commit b7f250b

Browse files
committed
added support for attribute lookup error callback
1 parent 7ab1fbe commit b7f250b

3 files changed

Lines changed: 31 additions & 1 deletion

File tree

src/PythonQt.cpp

Lines changed: 19 additions & 1 deletion

src/PythonQt.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ typedef void PythonQtVoidPtrCB(void* object);
7373
typedef void PythonQtQObjectWrappedCB(QObject* object);
7474
typedef void PythonQtQObjectNoLongerWrappedCB(QObject* object);
7575
typedef void* PythonQtPolymorphicHandlerCB(const void *ptr, const char **class_name);
76+
typedef QString PythonQtQObjectMissingAttributeCB(QObject* object, const QString& attribute);
7677

7778
typedef void PythonQtShellSetInstanceWrapperCB(void* object, PythonQtInstanceWrapper* wrapper);
7879

@@ -583,6 +584,12 @@ class PYTHONQT_EXPORT PythonQt : public QObject {
583584
//! call the callback if it is set
584585
static void qObjectNoLongerWrappedCB(QObject* o);
585586

587+
//! set a callback that is called when a QObject does not have a specific attribute.
588+
void setQObjectMissingAttributeCallback(PythonQtQObjectMissingAttributeCB* cb);
589+
590+
//! call the callback if it is set
591+
static QString qObjectMissingAttributeCallback(QObject* o, const QString& attribute);
592+
586593
//! called by internal help methods
587594
PyObject* helpCalled(PythonQtClassInfo* info);
588595

@@ -820,6 +827,7 @@ class PYTHONQT_EXPORT PythonQtPrivate : public QObject {
820827

821828
PythonQtQObjectNoLongerWrappedCB* _noLongerWrappedCB;
822829
PythonQtQObjectWrappedCB* _wrappedCB;
830+
PythonQtQObjectMissingAttributeCB* _qObjectMissingAttribCB;
823831

824832
QStringList _importIgnorePaths;
825833
QStringList _sharedLibrarySuffixes;

src/PythonQtInstanceWrapper.cpp

Lines changed: 4 additions & 0 deletions

0 commit comments

Comments
 (0)