[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:       Giuseppe Corbelli <corbelligiuseppe () mesdan ! it>
Date:       2018-04-09 9:11:40
Message-ID: 01208883-e501-976e-f5ae-f743ac657c5b () mesdan ! it
[Download RAW message or body]

On 04/05/2018 06:23 PM, Phil Thompson wrote:
> > > Please provide a short, complete example that demonstrates the problem.
> > 
> > git clone https://github.com/cowo78/QCustomPlot-PyQt5
> > cd QCustomPlot-PyQt5/
> > git checkout v2.0.0
> > git submodule update --init QCustomPlot
> > echo "" > helper.h
> > python3 setup.py build
> 
> Not exactly what I had in mind as a short, complete example...

I understand, but the error is located in a single point, not related to 
anything else, and the hierarchy is fairly complex and not easily cut.

> > Compilation will fail because of a missing typedef.
> > The relevant pieces are:
> > * template class QCPAbstractPlottable1D in plottable1d.sip
> > * typedef QCPAbstractPlottable1D<QCPBarsData> in plottable-bars.sip
> 
> It fails before that...
> 
> In file included from \
> build/temp.macosx-10.9-x86_64-3.7/sipQCustomPlotcmodule.cpp:15: \
> build/temp.macosx-10.9-x86_64-3.7/sipAPIQCustomPlot.h:20:10: fatal error: \
> 'QMetaType' file not found #include <QMetaType>
> 
> However, you have specified the typedef in the %TypeHeaderCode in \
> plottable-bars.sip. If you want the typedef to be visible to the rest of the \
> generated code then put it in %ModuleHeaderCode instead.

Well, my platform is not OSX but the directive seems fine and it is not 
end user code but was generated by sip.

I don't want the typedefs to be global, that is not the point.

Given the class:

template <DataType>
class QCPAbstractPlottable1D :
   public QCPAbstractPlottable, public QCPPlottableInterface1D /Abstract/
{
%TypeHeaderCode
#include <QCustomPlot/src/qcp.h>
typedef QCPAbstractPlottable1D<QCPGraphData>
   QCPAbstractPlottable1D_QCPGraphData;
typedef QCPAbstractPlottable1D<QCPBarsData>
   QCPAbstractPlottable1D_QCPBarsData;
%End
...
};


The generated code is:

#include <QCustomPlot/src/qcp.h>
typedef QCPAbstractPlottable1D_QCPBarsData<QCPGraphData>
   QCPAbstractPlottable1D_QCPBarsData_QCPGraphData;
typedef QCPAbstractPlottable1D_QCPBarsData<QCPBarsData>
   QCPAbstractPlottable1D_QCPBarsData_QCPBarsData;

Note that the typedefs have been somewhat elaborated, not just copied 
verbatim and somehow got screwed.
Maybe this is intentional and for sure I am by no means a SIP expert but 
at least it looks weird.
If it is intentional please excuse me for the unneeded noise.

-- 
Giuseppe Corbelli
_______________________________________________
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