On Wednesday 20 June 2012 10:47:01 Peter Kümmel wrote: > On 19.06.2012 11:04, Olivier Goffart wrote: > > template<typename T> QMetaObject A<T>::staticMetaObject = { ... }; > > Hi Oliver, > > looking at this with some hacking on moc, > > > template<class T> > class Foo : public QObject > { > Q_OBJECT > > public: > Foo() {} > > signals: > void asignal(T t); > > }; > > > it looks like generating templated code isn't complicated: > > void Foo<T>::qt_static_metacall > ... > > but then we also get > > static const char qt_meta_stringdata_Foo<T>[] = { > "Foo<T>\0\0t\0asignal(T)\0" > }; > > > Isn't this a big problem? > When Foo<int> is used, we would need the meta type information > with 'int' not with T: > > static const char qt_meta_stringdata_Foo<int>[] = { > "Foo<int>\0\0t\0asignal(int)\0" > };
That's because you are looking at Qt4. In Qt5 it is could be something more like "Foo<T>\0asignal\0\0T\0t\0" And you can connect using the new pointer function syntax. And some little changes would be required to the other syntax for it to work, but it should be possible (as now, the "signature" of the signal is only reconstructed at runtime) Foo<int> foo; connect(&foo, &Foo<int>::asignal, this, &Bar::setInt); connect(&foo, SIGNAL(signal(int)), this, SLOT(setInt(int))); -- Olivier Woboq - Qt services and support - http://woboq.com _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development