Gui: make sure the calltips show the added methods of MainWindowPy
This commit is contained in:
@@ -277,9 +277,13 @@ QMap<QString, CallTip> CallTipsList::extractTips(const QString& context) const
|
||||
// Make sure it's not a type object
|
||||
union PyType_Object typetype = {&PyType_Type};
|
||||
if (PyObject_IsInstance(obj.ptr(), typetype.o) != 1) {
|
||||
// For wrapped objects with PySide2 use the object, not its type
|
||||
// as otherwise attributes added at runtime won't be listed (e.g. MainWindowPy)
|
||||
QString typestr(QLatin1String(Py_TYPE(obj.ptr())->tp_name));
|
||||
|
||||
// this should be now a user-defined Python class
|
||||
// http://stackoverflow.com/questions/12233103/in-python-at-runtime-determine-if-an-object-is-a-class-old-and-new-type-instan
|
||||
if (Py_TYPE(obj.ptr())->tp_flags & Py_TPFLAGS_HEAPTYPE) {
|
||||
if (!typestr.startsWith(QLatin1String("PySide")) && Py_TYPE(obj.ptr())->tp_flags & Py_TPFLAGS_HEAPTYPE) {
|
||||
obj = type;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user