[PyQt] sip %ConvertToSubClassCode problem with %TypeHeaderCode doesn't work as expected.

Phil Thompson phil at riverbankcomputing.com
Thu Jun 3 16:26:57 BST 2010


On Thu, 03 Jun 2010 11:19:31 -0400, Blaine Bell
<blaine.bell at schrodinger.com> wrote:
> Phil Thompson wrote:
>> On Thu, 03 Jun 2010 10:19:11 -0400, Blaine Bell
>> <blaine.bell at schrodinger.com> wrote:
>>   
>>> Hi Phil,
>>>
>>> Thanks a lot for your quick response.  Unfortunately, I am using 
>>> sip-4.9.3, and neither of these fixes you have listed below work for
me.
>>>
>>> (sipType_ChmMainWindow or %ModuleCode is not recognized).

What does this actually mean?

>>> Also, looking into the <module>cmodule.cpp file, sipType does not get 
>>> instantiated in the static function that converts to a sub-class if 
>>> possible.  Am I doing something wrong, or is it a version issue?
>>>     
>>
>> Sounds like you are doing something wrong.
>>
>> Phil
>>   
> thanks.  It seems to work just fine, but I sense it is either its a 
> version issue or I am using the sip command line in a way that doesn't 
> allow this functionality that you mention.   The exact command line I am 
> using to generate the sip wrappers is:
> 
> sip -e -c . -b canvasapp.sbf -I /sip-4.9.3/share/PyQt4 -x VendorID -t 
> WS_X11 -x PyQt_NoPrintRangeBug -t Qt_4_5_0 -x Py_v3 -g canvasapp.sip
> 
> Most of these arguments are coming from the pyqtconfig module under 
> PyQt, to pass configuration information.  The conversion function inside 
> the cmodule.cpp looks like this (i.e., with no sipType defined):
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /* Convert to a sub-class if possible. */
> extern "C" {static const sipTypeDef *sipSubClass_ChmMainWindow(void **);}
> static const sipTypeDef *sipSubClass_ChmMainWindow(void **sipCppRet)
> {
>     QObject *sipCpp = reinterpret_cast<QObject *>(*sipCppRet);
>     sipWrapperType *sipClass;
> 
> #line 109 "canvasapp.sip"
>     ChmMainWindow *mw = dynamic_cast<ChmMainWindow *>(sipCpp);
>     if (mw){
>         sipClass = sipAPI_canvasapp->api_find_class("ChmMainWindow");
>     } else {
>         sipClass = NULL;
>     }
> #line 118 "sipcanvasappcmodule.cpp"
> 
>     return (sipClass ? sipClass->type : 0);
> }
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Does this resemble generated code from an old version?  If so, then it 
> could be possible that my sip installation or build process isn't
correct.

The code looks fine. It is properly handling the deprecated use of sipClass
rather than sipType.

Phil


More information about the PyQt mailing list