Yes, I could do that but there is a problem of type casts.

Indeed, the compiler can easily cast say between Car and Object, but vector<Car*> and vector<Object*> won't work.

So my library returns a vector<Car*>&, and the GUI cannot simply treat it as a vector<Object*>&. Except if I provide an explicit cast function, but I don't know how to do that. (I can not simply cast every item in a new vector, since I need to operate on the vector itself).

Anyway, the Qt documentation is not very clear about templates. It only says:
moc does not handle all of C++. The main problem is that class templates cannot have signals or slots. Here is an example:

class SomeTemplate<int> : public QFrame
{
Q_OBJECT
...

signals:
void mySignal(int);
};
So the derived class can't have signals. How about the base class? Is this valid:

Qt Code:
  1. template<class T> class SomeTemplate : public QTableModel
  2. {
  3. Q_OBJECT
  4. ...
  5.  
  6. signals:
  7. void mySignal(int);
  8. };
To copy to clipboard, switch view to plain text mode 

??