Programatically generated slot names

Christoph Feck christoph at maxiom.de
Mon Feb 2 12:22:03 GMT 2009


Am Monday 02 February 2009 08:25:50 schrieb Olivier Goffart:
> Le lundi 2 février 2009, Jeff Mitchell a écrit :
> > Olivier Goffart wrote:
> > >> Yeah, early on I tried removing SLOT from the name and simply
> > >> prepending "1" to the function name.
> > >
> > > That should have worked. (assuming the signature name was correct, with
> > > parenthesis and arguments)
> >
> > So, this is a bit strange:
> >
> > QString page( QString("1slotPage%1()").arg( m_pageNum ) );
> >
> > 1) QTimer::singleShot( 0, this, page.toAscii().constData() );
> > 2) QMetaObject::invokeMethod( this, page.toAscii().constData() );
> >
> > Given the above, #1 works, #2 doesn't.  Anyone know why?
> >
> > Thanks,
> > Jeff
>
> Because invokeMethod doesn't need the SLOT code.

It also looks incorrect to pass a temporary as a value for singleShot().




More information about the kde-core-devel mailing list