[PyKDE] un-connectable signals (probably sip bug)
Stefan Bund
l-pykde.z.xalan at xoxy.net
Sun Dec 21 09:16:01 GMT 2003
I have analyzed the situation a bit further. I don't know, if I read
the sip source correctly, but as far as I can understand it,
David Boddie <david at boddie.org.uk> writes:
> The following connection attempt
>
> k.connect(k, SIGNAL("windowAdded(unsigned long)"), fn)
>
> returns False, whereas
in this case, the PyKDE wrapper winds the proxySlot(unsigned long) in
it's table but Qt::connect returns false, since there is no
'windowAdded(unsigned long)' signal.
> k.connect(k, SIGNAL("windowAdded(long)"), fn)
> k.connect(k, SIGNAL("windowAdded(ulong)"), fn)
>
> both cause RuntimeError exceptions to be raised.
and in this case, PyKDE raises a RuntimeError since it cannot find a
proxySlot for either 'windowAdded(long)' or 'windowAdded(ulong)'.
As I can read it, the parameter specs are compared as strings ignoring
any whitespace. On the other hand, I have a feeling, that somewhere in
sip's guts, the knowledge, that WId is a typedef for unsigned long
exists, otherwise sip would try to generate proxySlot's for 'unsigned
long' *as well as* 'WId' which would fail, since C++ does not allow
overloading of identical typedef'ed types.
As I understand the situation, for exactly that reason, sip somewhere
filters the list of proxySlot's to generate. This information would
have to be used somewhere in sip/siplib/qtlib.cpp:searchProxySlotTable
to alias 'unsigned long' with 'WId'.
A short-term solution would be, to allow a for a four argument form of
the Connect statement to connect to a python slot along the lines of:
Qt.connect(sender,SIGNAL("windowAdded(WId)"),receiver.pyfunc,SLOT("pyfunc(unsigned long)"))
where receiver.pyfunc is the receiving function and the SLOT argument
just specifies the proxy to use ...
Right now, I had to work around this problem using QTimer and polling
KWinModule.windows() at regular intervals. Pretty scary but it works
;-/
I would be very interested in a long-term fix of this problem.
I have another problem (concerning the inability to really use
QByteArray) but thats another mail.
I will be on Christmas Holiday for the next two weeks and will only
have sporadic Internet access, so I might not answer promptly
Thank you for all the information,
Stefan Bund.
--
-- *DON'T* TRY TO REACH ME DIRECTLY AT ABOVE EMAIL ADDRESS. Any reply
-- received off-list at that address will be *silently* and
-- *unconditionally* dropped. You can attribute this inconvenience to
-- the proliferation of spammers on the Internet. I hope, you can
-- understand my position and accept my counter measures.
More information about the PyQt
mailing list