diff --git a/src/Gui/CallTips.cpp b/src/Gui/CallTips.cpp index 2a1a5e63b9..9927de2f10 100644 --- a/src/Gui/CallTips.cpp +++ b/src/Gui/CallTips.cpp @@ -277,9 +277,13 @@ QMap 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; } }