[PySide] [shiboken2] Shared pointer support
Friedemann Kleint
Friedemann.Kleint at qt.io
Wed Jan 15 15:35:06 CET 2020
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
--
Friedemann Kleint
The Qt Company GmbH
More information about the PySide
mailing list