[PyQt] Query on signature of %VirtualCatcherCode
Shaheed Haque
srhaque at theiet.org
Thu May 4 09:00:36 BST 2017
Hi,
I am trying to generate the correct SIP %VirtualCatcherCode for this method:
Syndication::SpecificDocumentPtr parse(
const Syndication::DocumentSource &source) const Q_DECL_OVERRIDE;
At present the SIP looks like this:
virtual Syndication::SpecificDocument *parse(const
Syndication::DocumentSource &source) const
[QSharedPointer<Syndication::SpecificDocument> (const
Syndication::DocumentSource &source)];
%MethodCode
...
%End
%VirtualCatcherCode
...
%End
And SIP generates the following prototype for the virtual catcher code:
=================
QSharedPointer<Syndication::SpecificDocument>
sipVH_Atom_0(sip_gilstate_t sipGILState, sipVirtErrorHandlerFunc
sipErrorHandler, sipSimpleWrapper *sipPySelf, PyObject *sipMethod,
const Syndication::DocumentSource& a0)
{
QSharedPointer<Syndication::SpecificDocument> sipRes = 0;
int sipIsErr = 0;
...
=================
The C++ compiler, not unreasonably, complains about the initialisation
of sipRes with an integer 0. Now, I suspect the real culprit here is
the QSharedPointer. AFAIK, this (and its various related classes) has
no direct representation in PyQt5; this is reflected in the use of the
dual-signature Python-versus-C++ facility in SIP and the %MethodCode I
generate.
I'm just trying to figure out what I need to write in my
%VirtualCatcherCode, but it is not clear to me how to handle this
error. Have I misunderstood the SIP dual-signature thing as it applies
in this case?
Any insights gratefully received.
Thanks, Shaheed
P.S. FWIW, this is with SIP 4.18.1 on Ubuntu.
More information about the PyQt
mailing list