Programatically generated slot names
Jeff Mitchell
mitchell at kde.org
Thu Jan 29 22:53:04 GMT 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
David Faure wrote:
> On Thursday 29 January 2009, Richard Moore wrote:
>> The SLOT macro actually tags a value to the end of the token iirc.
>
> No, at the beginning ;)
>
> qobjectdefs.h:#define SLOT(a) "1"#a
> qobjectdefs.h:#define SIGNAL(a) "2"#a
>
> This allows connect() to distinguish signal-to-slot connections
> from signal-to-signal connections.
>
> (and to barf on slot-to-signal connections like the one I found in plasma today :-)
>
Yeah, early on I tried removing SLOT from the name and simply prepending
"1" to the function name. Didn't work because something was looking for
the actual chars "SLOT(" in the method name, according to the odd
runtime output.
I'll check out invokeMethod. One thing I'm not sure of: if I want to
let the event loop process events (i.e. I don't need to have the method
run immediately), will using QueuedConnection have the same effect as a
singleShot in this case?
For fun I'll also try the concatenation outside the SLOT macro like
Kevin suggested, and see if that works too :-)
Thanks to all,
Jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
iEYEARECAAYFAkmCM08ACgkQANYdqNCuGCW5iQCdFTngysKSwPkO8KNq0D0MHfVq
XIsAoLKGiqNlyRgMaLjrdHV0WkWO1Fjj
=iFGM
-----END PGP SIGNATURE-----
More information about the kde-core-devel
mailing list