Programatically generated slot names

Jeff Mitchell mitchell at kde.org
Wed Jan 28 00:30:49 GMT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

For a design I'm putting together, I will need to trigger a series of
slots in succession, returning to a master "control" function in
between.  I *could* do something like (very pseudocode):

switch i:
case 1: singleshot slotPage1
case 2: singleshot slotPage2
...
case n: singleshot slotPagen

However, what I'd prefer to do is something like this:

singleshot( SLOT( "slotPage" + n.toString() ) )

In other words, since signal and slot names are simply const char *, I'd
like to be able to construct this value programatically.  However, I
don't know if this value is needed at moc time, compile time, or run
time.  The various things I've tried to far don't work, either because
the constructed string gets mangled, or because I don't have SLOT around
it which seems to be a requirement at some level (even if I'm
duplicating its functionality as defined in the relevant header file,
which I don't remember right now).

Anyone know if this is possible?

Thanks,
Jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)

iEYEARECAAYFAkl/pzUACgkQANYdqNCuGCVMPgCgg6tXl4OykzZwlkCJDYf7UPCD
ptQAn3ju3YLy6cGV5losPr9QNJx2SUdG
=+UYs
-----END PGP SIGNATURE-----




More information about the kde-core-devel mailing list