It is not possible* in standard Qt, as for Qt, as for these classes moc needs to be able to pre-process the class and generate the needed meta data structures. That is done before compilation, and for a template class that means that the type is not really defined yet.
However, some things are possible:
- A QObject can have templated methods, as long as they are not marked as invokable, slot or signal.
- You can create a template class that inherits a QObject-derived class. It cannot have a Q_OBJECT macro or add signals, slots or properties, but it can be a useful trick, for instance to create a templated generic QAbstractItemModel.
- You could use Verdegris instead of moc. It uses a template-based alternative to moc that generates moc-compatible code. This should also allow for templated QObjects.
*) nothing is really impossible of course... If everything else fails, you can also implement everything moc provides yourself...