0

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.

2 Answers 2

2

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?

Sign up to request clarification or add additional context in comments.

2 Comments

I'm sorry for my bad question !
I also found an interesting thread at > lists.trolltech.com/qt-interest/2008-03/msg00575.html :)
0

The QThread documentation is misleading, you don't need to and shouldn't be sub classing QThread here for your widget.

"You're doing it wrong" - http://labs.qt.nokia.com/2010/06/17/youre-doing-it-wrong/

You should either:

  • Create a QThread ogreThread, create your ogreWidget and ogreWidget.moveToThread(&ogreThread), or
  • Create a QThread wrapper that allows you to tell it to create a new object of type T directly in the new thread.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.