[Qt-interest] QWidget and QThread ?

Sean Harmer sean.harmer at maps-technology.com
Fri Jun 5 12:03:03 CEST 2009


Hi,

On Friday 05 Jun 2009 10:56:35 Patric wrote:
> Hi all,
> 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 ?
In general no. You can only inherit from QObject once and both QWidget and 
QThread are derived from QObject.

Also all GUI operations must be performed in the main thread (the one in which 
QApplication lives).

I would go even further and suggest that you redesign your application to 
separate out the data and processing side from the GUI side. It will make 
things cleaner in the long run.

What is it you are trying to achieve? We may be able to give you some nudges 
in suitable directions?

Cheers,

Sean




More information about the Qt-interest-old mailing list