[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] SIP multiple inheritance with template base class
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2018-03-31 10:57:30
Message-ID: 804CCB55-7F6D-4477-B7D5-DE327EC09BED () riverbankcomputing ! com
[Download RAW message or body]

On 30 Mar 2018, at 1:53 pm, Giuseppe Corbelli <corbelligiuseppe@mesdan.it> wrote:
> 
> 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?

I'm not sure what the issue is that you are raising. Is it the fact that you have to \
provide the C++ typedef (and, if you do, it works Ok)? If you specify something in \
the .sip file it is assumed that this reflects something that is in the C++ code - \
and you need to provide it if it doesn't.

Phil
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic