[PyKDE] Question on sipConvertRx (version 2.4)

Phil Thompson phil at river-bank.demon.co.uk
Fri Jun 29 00:36:10 BST 2001


Thomas Malik wrote:
> 
> Hi,
> I tumbled over this when i used the KToolBar.insertCombo method, like this
> toolbar.insertCombo( ['a' ], id, self.isEditable(),
>           SIGNAL('activated(int)'), self.slotActivated, 1, self.shorttext
>           )
> 
> The slotActivated method will be called without arguments (giving me a
> wrong argument count error). The sip declaration looks like
> int insertCombo(QStrList *,int,bool,const char*,SIP_RXOBJ_CON,SIP_SLOT_CON
> (),
>                 bool = 1,const char * = 0,int = 70,int=-1,
>                 QComboBox::Policy = QComboBox::AtBottom);
> 
> The interesting piece of c++ code looks like
> a4 = sipConvertRx(sipNewProxy_kdeui,sipThis,"()",a4obj,NULL,&a5,&iserr);
> 
> One could put an int parameter into SIP_SLOT_CON(), but there are actually
> 2
> possible signal parameters, e.g. activated(int) and activated(const char*)
> and i would end up being able to connect to only one of them. So i moved
> the code
> to a %MemberCode section doing this:
> 
> sigargs = a3; // the signal name
> while (*sigargs && *sigargs != '(')
>    sigargs++;
> a4 = sipConvertRx(sipNewProxy_kdeui,sipThis,sigargs,a4obj,NULL,&a5,&iserr);
> 
> Then it works with both.
> 
> Shouldn't this be generally done in sipConvertRx ? Any other idea ?

It can't be simply be implemented in sipConvertRx because it needs to be
told which of the other arguments is the signal. It could be automated
by introducing a SIP_SIGNAL type to replace the const char * in the SIP
definition. Added to the TODO list.

The solution you've got is the one I would implement.

Phil




More information about the PyQt mailing list