John Floyd | 29 Jun 2012 09:22
Picon

New vs new signals - signatures

The question relates to the signatures used to connect overloaded signals.

 

What do you use for signature in the new signals. I have tried using the same arguments that are specified in the old method but does not work.

 

Eg an example from pyqwt

 

old method

 

self.picker.connect(self.picker, SIGNAL('selected(const QwtPolygon&)'), self.slotter)

 

have tried

self.picker.selected[QwtPolygon].connect(self.slotter)

and

self.picker.selected['QwtPolygon'].connect(self.slotter)

with no success.

 

the user docs does suggest "A type is either a Python type object or a string that is the name of a C++ type"

 

In this regard I have notices that in the code generated from the sip files, the pyqt4QtSignal defintion is

 

selected(QwtPolygon)

 

This is particularly confusing where for mappedtypes from a template where the c++ variable is QArray<QwtDoublePoint> which is in the c++ signature whilst the python 'equivalent' is QwtQArrayQwtDoublePoint.

 

Clarification would be very useful. At the moment I am not sure if there is a coding problem (mine or at the sip end) or just my ignorance.

 

Cheers

John

 

 

<div>
<p>The question relates to the signatures used to connect overloaded signals.</p>
<p>&nbsp;</p>
<p>What do you use for signature in the new signals.  I have tried using the same arguments that are specified in the old method but does not work.</p>
<p>&nbsp;</p>
<p>Eg an example from pyqwt</p>
<p>&nbsp;</p>
<p>old method </p>
<p>&nbsp;</p>
<p>	self.picker.connect(self.picker, SIGNAL('selected(const QwtPolygon&amp;)'), 		      self.slotter)</p>
<p>&nbsp;</p>
<p>have tried </p>
<p>	self.picker.selected[QwtPolygon].connect(self.slotter)</p>
<p>and </p>
<p>	self.picker.selected['QwtPolygon'].connect(self.slotter)  </p>
<p>with no success.</p>
<p>&nbsp;</p>
<p>the user docs does suggest "A type is either a Python type object or a string that is the name of a C++ type"</p>
<p>&nbsp;</p>
<p>In this regard I have notices that in the code generated from the sip files, the pyqt4QtSignal defintion is </p>
<p>&nbsp;</p>
<p>	selected(QwtPolygon)</p>
<p>&nbsp;</p>
<p>This is particularly confusing where for mappedtypes from a template where the c++ variable is QArray&lt;QwtDoublePoint&gt; which is in the c++ signature whilst the python 'equivalent' is QwtQArrayQwtDoublePoint.</p>
<p>&nbsp;</p>
<p>Clarification would be very useful.  At the moment I am not sure if there is a coding problem (mine or at the sip end) or just my ignorance.</p>
<p>&nbsp;</p>
<p>Cheers</p>
<p>John</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</div>
Phil Thompson | 29 Jun 2012 09:52

Re: New vs new signals - signatures

On Fri, 29 Jun 2012 17:22:51 +1000, John Floyd <jfloyd <at> bigpond.net.au>
wrote:
> The question relates to the signatures used to connect overloaded
signals.
> 
> What do you use for signature in the new signals.  I have tried using
the
> same 
> arguments that are specified in the old method but does not work.
> 
> Eg an example from pyqwt
> 
> old method 
> 
> 	self.picker.connect(self.picker, SIGNAL('selected(const QwtPolygon&)'),

>       self.slotter)
> 
> have tried 
> 	self.picker.selected[QwtPolygon].connect(self.slotter)
> and 
> 	self.picker.selected['QwtPolygon'].connect(self.slotter)  
> with no success.

Define "no success".

> the user docs does suggest "A type is either a Python type object or a
> string 
> that is the name of a C++ type"
> 
> In this regard I have notices that in the code generated from the sip
> files, 
> the pyqt4QtSignal defintion is 
> 
> 	selected(QwtPolygon)
> 
> This is particularly confusing where for mappedtypes from a template
where
> the 
> c++ variable is QArray<QwtDoublePoint> which is in the c++ signature
> whilst 
> the python 'equivalent' is QwtQArrayQwtDoublePoint.
> 
> Clarification would be very useful.  At the moment I am not sure if
there
> is a 
> coding problem (mine or at the sip end) or just my ignorance.

They should be interchangeable. In the current of PyQt a bound signal has
a "signal" attribute that is the corresponding C++ signal so you can check
what signature is actually being used.

Phil

Gmane