Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
None
-
5.14.1
-
None
-
-
2e5cdd6bd8e99544fd9370900d30edda2c05c6f9 (pyside/pyside-setup/5.14)
Description
I am wrapping a C++/Python API where quite a number of classes inherit from the same (polymorphic) base class. An example:
class PolymorphicBaseClass { public: PolymorphicBaseClass() = default; virtual ~PolymorphicBaseClass() = default; /* Workaround: virtual dummyMethodForShiboken() { Instead of having to write a lot of polymorphic-id-expressions, one can write a dummy virtual method in PolymorphicBaseClass. and shiboken sees it as polymorphic. } */ void doSomething() {} }; class InheritedClass : public PolymorphicBaseClass { public: InheritedClass() = default; void doSomethingElse(); };
During CPython code generation shiboken outputs warnings like:
qt.shiboken: (typesystem) InheritedClass inherits from a non polymorphic type (PolymorphicBaseClass), type discovery based on RTTI is impossible, write a polymorphic-id-expression for this type.
Using the workaround mentioned in above example code will silence this warning. More important possible failures on the Python side are reduced.