[EXTERNAL] Re: Hit bug in sip wrapper generation of template expansion involving enums
Gehlhaar, Daniel Kurt
dan.gehlhaar at pfizer.com
Thu Mar 4 15:36:28 GMT 2021
Phil,
Apologies. Please see attached. The easiest way to replicate this is to put the enum declaration in the same file (as here). In the actual production process, it is in a different directory and is built into a dependent sip module. I think if this case is fixed, it will fix the other case.
In any case, this is a "showstopper" for me, I cannot proceed with my migration from sip 4 to sip 6 unless this is resolved. Any advice or mitigation you could provide would be helpful.
Regards,
Dan
-----Original Message-----
From: Phil Thompson <phil at riverbankcomputing.com>
Sent: Thursday, March 4, 2021 6:20 AM
To: Gehlhaar, Daniel Kurt <dan.gehlhaar at pfizer.com>
Cc: 'pyqt at riverbankcomputing.com' <pyqt at riverbankcomputing.com>
Subject: [EXTERNAL] Re: Hit bug in sip wrapper generation of template expansion involving enums
On 03/03/2021 23:43, Gehlhaar, Daniel Kurt wrote:
> I hit a problem moving from sip 4.19.3 to sip 6.0.2 involving the code
> generation relating to the following sample, specifically the
> QMap<MyEnum,QColor>:
>
>
> #ifndef COLORS_H
> #define COLORS_H
>
> #include <qcolor.h>
> #include <qobject.h>
> #include <qmap.h>
> #include "DefinesMyEnum.h"
>
> class Colors : public QObject
> {
> Q_OBJECT;
>
> public:
> Colors();
>
> const QMap<MyEnum, QColor> &GetColors() const
> { return colors; }
>
> protected:
>
> QMap<MyEnum, QColor> colors;
> };
>
> #endif
>
>
> #ifndef DEFINES_MY_ENUM_H
> #define DEFINES_MY_ENUM_H
>
> enum MyEnum
> { THIS, THAT };
>
> #endif
>
> %Module Colors
>
> class Colors : QObject
> {
> %TypeHeaderCode
> #include "Colors.h"
> %End
>
> public:
> Colors();
>
> const QMap<MyEnum, QColor> &GetColors() const ; };
>
> In sip 4.19.3, each .sip file generated a .cpp file. In sip 6.0.2,
> this is not necessarily the case. In this case, the
> QMap<MyEnum,QColor> gets wrapped in its own .cpp file that DOES NOT
> INCLUDE the definition of the MyEnum type (i.e. it does not include
> "DefinesMyEnum.h"). This results in myriad compiler errors:
>
> sipPyTESTQMap0100MyEnum0100QColor.cpp(18): error C2065: 'MyEnum':
> undeclared identifier
> sipPyTESTQMap0100MyEnum0100QColor.cpp(18): error C2923: 'QMap':
> 'MyEnum' is not a valid template type argument for parameter 'Key'
>
> Please fix, or let me know what I need to do on my end to fix.
Please provide a complete example as separately attached files. The pyproject.toml file is missing along with the .sip file for MyEnum.
Phil
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TEST.zip
Type: application/x-zip-compressed
Size: 1664 bytes
Desc: TEST.zip
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210304/85117ef0/attachment.bin>
More information about the PyQt
mailing list