[PyQt] SIP_ANYSLOT vs SIP_SLOT vs SIP_SLOT_CON()
phil at riverbankcomputing.com
Tue Sep 10 17:55:04 BST 2013
On Tue, 10 Sep 2013 16:17:25 +0200, Sébastien Sablé
<sable at users.sourceforge.net> wrote:
> [sorry previous email was sent before I finished it]
> I want to bind with sip a connect method which can be used with a slot
> which the signature will change from one call to the other.
That doesn't sound like a great design...
> The class looks a bit like that:
> class Foo
> void connect(const int eventType, QObject *receiver, const char
> I have seen quite a few example in the doc or in PyQt using
> and SIP_SLOT_CON.
> However it seems SIP_SLOT_CON can only be used when you know the
> of your signal in advance.
> The documentation mentions also SIP_SLOT and SIP_ANYSLOT but is very
> on the details.
> SIP_ANYSLOT requires to write some custom code to handle conversion as
> be seen in the code for QShortcut.
> I could not find any example for SIP_SLOT anywhere.
> What is the difference between SIP_ANYSLOT and SIP_SLOT? Which one
> use? And can you provide an example when using SIP_SLOT?
SIP_SLOT just checks that the argument has been created by QtCore.SLOT(),
ie. that it is a string that begins with the magic character. Plenty of
examples in PyQt4.
SIP_ANYSLOT checks that the argument has been created by QtCore.SLOT() (in
which case it is placed in a variable called a?Name, where ? is the number
of the argument) or it is a callable (in which case it is placed in a
variable called a?Callable).
More information about the PyQt