[Qt-interest] QWidget and QThread ?

Alexandre Courbot gnurou at gmail.com
Fri Jun 5 12:03:16 CEST 2009


Hi,

> I have a form, which i generate in a widget using the multiple inheritance
> approach. I need a thread that operates on the data of this widget.
> I'm wondering, is it a good idea to make my widget thread also (i.e.
> multiple inheritance from QWidget and QThread), so it'll be more convinient
> to operate on the data. What do you think about it ?

As both QThread and QWidget inherit from QObject, you would end with
two copies of QObject which makes it difficult to connect signals
correctly. I think this messes the meta-object compiler too. I don't
think you should do that. Separating the thread from the form and
letting them interact through signals seems a more reasonnable
solution.

Alex.



More information about the Qt-interest-old mailing list