Thiago Macieira wrote: > On Wednesday, 21 de September de 2011 15.12.21, Thiago Macieira wrote: >> There's no way around it. Since we're using the function pointer >> (actually, the PMF) to identify the signal, you must have C++ access to >> the signal function. That means you must be able to call it. >> >> Other template-based signal libraries have the same problem. It cannot be >> avoided unless you have a way to identify the signal which doesn't >> include access to the actual signal implementation. >> >> One solution to that would be to have an enum of signals, instead of >> identifying by an object or by a PMF. > > Another solution (also by way of adding an indirection) is to add a > function that emits, which is protected. > > template <typename Klass, typename... Args> > void QObject::emitSignal(void (Klass:: *signal)(Args...), Args... args); > > Then you'd write: > emitSignal(&Me::textChanged, newText); > instead of: > emit textChanged(newText); > > The template magic to make that happen is already present. > > However, it would be completely source-incompatible with the existing > code, which is a big no-no. It would require making the signal functions > themselves not do anything -- only serve as identifiers. >
For source compatibility they could be implemented by moc to work as currently, no? _______________________________________________ Qt5-feedback mailing list [email protected] http://lists.qt.nokia.com/mailman/listinfo/qt5-feedback
