[PyQt] Sip and pure virtual functions

Phil Thompson phil at riverbankcomputing.com
Wed Jan 4 10:40:32 GMT 2017


On 4 Jan 2017, at 8:16 am, Guðjón Guðjónsson <gudjon.i.gudjonsson at gmail.com> wrote:
> 
> Hi list
> 
> I have been writing a python wrapper to the qwt6 library. It is new code, doesn't 
> build on PyQwt5.
> 
> Qwt library:
> http://qwt.sourceforge.net/
> 
> My python wrapper:
> https://github.com/GauiStori/PyQt-Qwt
> 
> I do have a problem with pure virtual functions in Qwt.

So what is the problem?

> My solution is to 
> provide a default implementation for these functions but I really don't like
> adding a patch to the Qwt library.
> 
> The patch looks like this:
> --- a/src/qwt_series_data.h
> +++ b/src/qwt_series_data.h
> @@ -54,14 +54,14 @@
>      virtual ~QwtSeriesData();
>  
>      //! \return Number of samples
> -    virtual size_t size() const = 0;
> +    virtual size_t size() const {return 0;};
>  
>      /*!
>        Return a sample
>        \param i Index
>        \return Sample at position i
>       */
> -    virtual T sample( size_t i ) const = 0;
> +    virtual T sample( size_t i ) const {return T();};
>  
>      /*!
>         Calculate the bounding rect of all samples
> 
> Is anyone willing to help me with this?
> 
> Another problem is getting the Qt include dir into the configure.py script.
> I have to admit that I don't understand how it is done in the QScintilla script.
> Can anyone point me to another example?

Again, what is the problem?

Phil


More information about the PyQt mailing list