[PyQt] SIP multiple inheritance with template base class

Giuseppe Corbelli corbelligiuseppe at mesdan.it
Fri Mar 30 13:53:37 BST 2018


Hi all
for an ongoing project I am developing a Python interface for QCustomPlot.
You can find it at https://github.com/cowo78/QCustomPlot-PyQt5/tree/v2.0.0

My first attempt with sip so look out for stupid mistakes.

SIP 4.19.8, (Py)Qt 5.9.2 on linux/gcc 7.3

I have the following hierarchy:

template <DataType>
class QCPAbstractPlottable1D : public QCPAbstractPlottable, public 
QCPPlottableInterface1D /Abstract/
{
%TypeHeaderCode
#include <QCustomPlot/src/qcp.h>
#include "helper.h"
%End
{ ... }

typedef QCPAbstractPlottable1D<QCPBarsData> 
QCPAbstractPlottable1D_QCPBarsData;

class QCPBars : public QCPAbstractPlottable1D_QCPBarsData
{
%TypeHeaderCode
#include <QCustomPlot/src/qcp.h>

typedef QCPAbstractPlottable1D<QCPBarsData> 
QCPAbstractPlottable1D_QCPBarsData;
%End
...
}

Nevermind the helper.h include for a second. With this code the c++ 
generated for the QCPAbstractPlottable1D_QCPBarsData lacks a typedef.

The typedef'ed template specialization produces 
sipQCustomPlotQCPAbstractPlottable1D_QCPBarsData.cpp which references 
the typedef itself (QCPAbstractPlottable1D_QCPBarsData) but it is not 
copied in the generated file. The helper.h just works around the issue 
by providing the relevant typedef.

The full error can be reproduced by checking out branch v2.0.0 of 
https://github.com/cowo78/QCustomPlot-PyQt5.git and commenting out the 
#include "helper.h" directive.

Something wrong in my approach or an obscure bug somewhere?

Thanks

-- 
Giuseppe Corbelli


More information about the PyQt mailing list