c++qtmultiple-inheritanceqobjectogre

Multiple inheritance with QThread and QWidget ( Multiple inheritance with QObject )


I'm going to design OgreWidget class -A portable renderer widget with Qt.

(With my design), I think my class need to be inherited with QThread (for infinite render loop ) and QWidget ( target widget for ogre to render there) .

But according to many documentation and articles (for instance this), Virtual inheritance with QObject is not supported . Result of this inheritance will be such a error:

QObject is an ambiguous base of OgreWidget

How should I resolve this problem ?

PS: In my old design , I create a separate QWidget , and Send It's WId to my OgreWidget as target widget. However, I'm now going to design a better and cleaner interface.


Solution

  • That's impossible, because both QThread and QWidget in the end resolve to QObject base class

    This thread answers your question: how can i inherit from both QWidget and QThread?