[PyQt] Old vs New Signals
phil at riverbankcomputing.com
Mon Jul 9 11:18:40 BST 2012
On Sun, 08 Jul 2012 17:43:55 +1000, John Floyd <jfloyd at bigpond.net.au>
> Note Corrected Subject (was New vs New ... sorry)
> I have 2 cases where I am having difficulties in PyQwt signals. Since
> original post I have investiagted the PyQwt code a bit closer and the
> following comes from that. The previous discussions helped me in
> further into the problem.
> 1) a c++ typedef variable appears to cause problems
> The old style signal works
> self.picker.connect(picker,SIGNAL('selected(const QwtPolygon &)')
> however the new style signal does not work.
> Reported error
> NameError: global name 'QwtPolygon' is not defined
> Yet the MetaObject lists the following as a signal signature
> The reasoning appears to be that in the c++ code QwtPolygon is
> QPolygon. Shouldnt this be handled?
> 2) Problems with template argument the signal definition. For example
> SIGNAL('selected(const QwtArray<QwtDoublePoint>&)'), self.slot)
> returns an error
> TypeError: C++ type 'QwtArray<QwtDoublePoint>' is not supported as a
> argument type
> The signature is listed in the GmetaObject.
> In the sip code QwtArray<QwtDoublePoint> is MappedTyped as
> QwtArrayQwtDoublePoint - using this as the signature as below returns
> another error
> SIGNAL('selected(const QwtArrayQwtDoublePoint&)'), self.slot)
> and also as a new signal
> TypeError: connect() failed between selected(QwtArrayQwtDoublePoint) and
> Phil Thompson has said that in this case the python code should accept
> signature but it does not.
> Intriquingly the definition of QwtArray is also a c++ typedef in the Qwt
> The trouble is that for this particlar picker class, the selected signal
> overloaded multiple times so the signatures are necessary.
As far as I can see the only class with a signal selected(QwtPolygon) is
QwtPicker and that doesn't overload the signal. The only class that does is
QwtPlotPicker, but you don't say which you are using.
Maybe the problem is your picker is a QwtPlotPicker but you are trying to
use QwtPicker.selected? In which case try...
More information about the PyQt