Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
None
-
5.13.2
-
None
Description
Having to deal with class/member declarations like this:
class MyClass : public QObject { Q_OBJECT public: enum MyEnum { One, Two, Three }; // not using enum class here Q_ENUM(MyEnum); public: MyClass(QObject* parent = 0); Q_INVOKABLE void doSomethingWithEnum(int my_enum = One); // <-- shiboken fails here }; // function definitions for completeness (originally in cpp file) MyClass::MyClass(QObject* parent) : QObject(parent) {} MyClass::doSomethingWithEnum(int my_enum) { /* do something with it */ }
The code generated by Shiboken fails to compile (type lookup fails) and looks similar to this (from my head):
void sbk_wrapped_my_class_do_something_with_enum(/* PyObject etc. */) { // only the relevant code PyInt tmp_value = MyEnum::One; // not sure the type is correct, but it doesn't matter here // --> should be MyClass::One (or MyClass::MyEnum::One for an enum class) }
(Looking at it again the default parameter declaration is actually wrong and should read "MyClass::One". Don't know why, but original C++ code actually compiles with this.)
Edit: Same results with fixed code.
However users can solve (workaround) this by removing the default parameter assignment from the method declaration.
Attachments
Issue Links
- duplicates
-
PYSIDE-1095 Wrong scope generated for argument default value
- Closed