[PyQt] Old vs New Signals
John Floyd
jfloyd at bigpond.net.au
Sun Jul 8 08:43:55 BST 2012
Note Corrected Subject (was New vs New ... sorry)
I have 2 cases where I am having difficulties in PyQwt signals. Since my
original post I have investiagted the PyQwt code a bit closer and the
following comes from that. The previous discussions helped me in looking
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 &)')
,self.slot)
however the new style signal does not work.
self.picker.selected[QwtPolygon].connect(self.slot)
Reported error
NameError: global name 'QwtPolygon' is not defined
Yet the MetaObject lists the following as a signal signature
selected(QwtPolygon).
The reasoning appears to be that in the c++ code QwtPolygon is typedef'ed from
QPolygon. Shouldnt this be handled?
2) Problems with template argument the signal definition. For example
self.picker.connect(self.picker,
SIGNAL('selected(const QwtArray<QwtDoublePoint>&)'), self.slot)
returns an error
TypeError: C++ type 'QwtArray<QwtDoublePoint>' is not supported as a slot
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 yet
another error
self.picker.connect(self.picker,
SIGNAL('selected(const QwtArrayQwtDoublePoint&)'), self.slot)
and also as a new signal
self.picker.selected[QwtArrayQwtDoublePoint].connect(self.slot)
TypeError: connect() failed between selected(QwtArrayQwtDoublePoint) and
unislot()
Phil Thompson has said that in this case the python code should accept the c++
signature but it does not.
Intriquingly the definition of QwtArray is also a c++ typedef in the Qwt code.
The trouble is that for this particlar picker class, the selected signal is
overloaded multiple times so the signatures are necessary.
Any further help is appreciated.
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20120708/b10fe432/attachment-0001.html>
More information about the PyQt
mailing list