Hi, first of all thanks for addressing the virtual method issue. That was quick! Also thanks for the answers provided to my other two questions.
I am still struggeling to get my application run correctly, but I assume that this is due to learning shiboken. However, one thing is happening quite often when using QSharedPointers with 5.14.0 (see stack trace below). I think this happens when type conversions are not possible (I can create this issue when calling "d.set([1])" from python where d is an instance of a wrapped class and set is a C++ function expecting a "const QList<QSharedPointer<A> >&" argument. Clearly, the integer 1 is not convertable to a shared A pointer. It probably should not crash the application, though. Please give me a note if I should create a report with a minimal test case. Kind Regards Chris /tmp/shiboken2-tests/lib/python3.7/site-packages/shiboken2/files.dir/shibokensupport/signature/parser.py:191: RuntimeWarning: pyside_type_init: UNRECOGNIZED: 'ptest.QSharedPointer' OFFENDING LINE: 'ptest.D.append(a:ptest.QSharedPointer[ptest.A])' """.format(thing, line), RuntimeWarning) Traceback (most recent call last): File "/tmp/shiboken2-tests/lib/python3.7/site-packages/shiboken2/files.dir/shibokensupport/signature/loader.py", line 93, in pyside_type_init return parser.pyside_type_init(type_key, sig_strings) File "/tmp/shiboken2-tests/lib/python3.7/site-packages/shiboken2/files.dir/shibokensupport/signature/parser.py", line 435, in pyside_type_init props = calculate_props(line) File "/tmp/shiboken2-tests/lib/python3.7/site-packages/shiboken2/files.dir/shibokensupport/signature/parser.py", line 324, in calculate_props annotations[name] = _resolve_type(ann, line, 0, handle_argvar) File "/tmp/shiboken2-tests/lib/python3.7/site-packages/shiboken2/files.dir/shibokensupport/signature/parser.py", line 267, in _resolve_type return eval(result, namespace) File "<string>", line 1, in <module> AttributeError: module 'ptest' has no attribute 'QSharedPointer' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/tmp/shiboken2-tests/lib/python3.7/site-packages/shiboken2/files.dir/shibokensupport/signature/loader.py", line 101, in seterror_argument return errorhandler.seterror_argument(args, func_name) File "/tmp/shiboken2-tests/lib/python3.7/site-packages/shiboken2/files.dir/shibokensupport/signature/errorhandler.py", line 99, in seterror_argument sigs = get_signature(func, "typeerror") SystemError: <built-in function get_signature> returned a result with an error set Fatal Python error: seterror_argument did not receive a result Current thread 0x00007fabf8e55740 (most recent call first): File "test.py", line 10 in main File "test.py", line 51 in <module> Aborted On 15.01.20 15:35, Friedemann Kleint wrote: > Hi, > > > It seems that wrapping classes which return shared pointers in a > virtual method is not possible at all. Non-virtual functions are fine. > The error from shiboken2 is "#error: > > > CppGenerator::writeVirtualMethodNative: B::genA(): Could not find a > minimal constructor for type 'QSharedPointer<A >'. This will result in a > compilation error.". > > This is now in the works (see bugreports.qt.io/browse/PYSIDE-1188 ). > > > it seems to be impossible to create a shared pointer from an object > generated from the python side. > > This is still to be discussed for bugreports.qt.io/browse/PYSIDE-454 ; > maybe some kind of make_shared() method could exposed. Right now, some > C++ factory function is needed. > > > The documentation in shiboken regarding smart pointers seems to be > very limited. I couldn't figure out if setting "ref-count-method" is > required and why? > > > QSharedPointer, there ? ? doesn't seem to exist a method for querying > the reference count. > > The refcount method is optional; there will be a binding generated for > it if it exists. QSharedPointer is for example used in > > sources/pyside2/PySide2/QtQuick/typesystem_quick.xml: > <smart-pointer-type name="QSharedPointer" type="shared" getter="data"/> > > Regards, Friedemann > _______________________________________________ PySide mailing list PySide@qt-project.org https://lists.qt-project.org/listinfo/pyside