Have anyone did template parameter or template class with QT?
What I want to do is create a function called addObject(const T* ob), then other class call this function to add an instance of a class. Is all the classes in QT inherited from QObject by default? If it is the case, maybe I can change my function to be like following: addObject(QObject * ob). But I doubt that.
If not, how can achieve this? I have tried with addObject(void * ob), seems still couldn't compile, anyone got a clue?
Re: Have anyone did template parameter or template class with QT?
Explain why you would want to do this? What problem are you trying to solve.
Many Qt classes are derived from QObject, but not all.
Re: Have anyone did template parameter or template class with QT?
Each pointer can be converted to a void*. If it doesn't work, the problem lies in some other place. But I'm not saying you should use void*.
Re: Have anyone did template parameter or template class with QT?
Answer to question is: yes, you can program templates with Qt. (check the link, maybe this is what you are looking for ;) )
And to add to what ChrisW67 said: the solution is to check the documentation and see what class derive from what, and, as ChrisW67 said: give more details about the problem you are trying to solve, so that we can give better advices.
Re: Have anyone did template parameter or template class with QT?