[PyQt] unsupported function return type - provide %MethodCode and a C++ signature

Kevin Connor Arpe kevinarpe at gmail.com
Sun Apr 26 15:42:41 BST 2015


Hello,

This is my first post.

I forked the official QCustomPlot Git repo
<https://gitorious.org/qcustomplot> to add Py3Qt5 bindings.  So far so
good.  The basics work OK.

A few of the methods return (or receive) complex data structures of either
QMap or QHash.

One good example:
typedef QMap<double, QCPBarData> QCPBarDataMap;
QCPBarDataMap *QCPBars::data() const;
void setData(QCPBarDataMap *QCPBars::data, bool copy=false);

Ref:
https://github.com/kevinarpe/qcustomplot/blob/v1.3.1-Py3Qt5/src/plottables/plottable-bars.sip

If these two methods are enabled, I see a SIP error message as follows:
unsupported function return type - provide %MethodCode and a C++ signature
unsupported argument return type - provide %MethodCode and a C++ signature

On the surface, it makes sense, as these are quite complex data structures
as input/output.

I looked at the PyQt5 source file: sip/QtCore/qpycore_qmap.sip.  And the
official SIP docs here: %MappedType

I tried %Include QtCore/QtCoremod.sip, but no luck; same with %Include
QtCore/qpycore_qmap.sip.

As I'm new to SIP, I'm unsure if I need %MappedType or %MethodCode in this
case.  I suppose %MappingType can be more generic, and %MethodCode specific
per ctor/method.

It is also possible that typedef is a problem.

What path do you advise to fix this issue with my SIP files?

(If there are old mailing list items about this, please kindly refer.  I
couldn't find anything on Google.)

Thanks,
Arpe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150426/2043cbe9/attachment.html>


More information about the PyQt mailing list