[Qt-interest] Problem of the classes

Sean Harmer sean.harmer at maps-technology.com
Fri Jan 9 15:01:55 CET 2009


Hi,

On Friday 09 January 2009 13:42:49 Neeraj Jhawar wrote:
> I want the thread.run() to be able to access the textpAmp0 and disable it.
> Is it possible for a public member of a subfunction to access a private
> member of the member.
> If not what is the best solution.
Get your Thread class to emit a signal. Create a slot on your guiwindow class. 
Connect the signal to the slot using a Qt::QueuedConnection. Do the necessary 
disabling/enabling in the slot which will of course have full access to the 
needed members.

> Would making all the widgets public help??
In principal this would allow you access but it would be a bad idea and a 
waste of time. It is a bad idea because you wold be exposing internal data 
breaking encapsulation. And it would be a waste of time as Qt does not allow 
you to modify the GUI form any thread other than the main thread. Please read 
the documentation on multithreading with Qt:

http://doc.trolltech.com/4.4/threads.html

Good luck,

Sean




More information about the Qt-interest-old mailing list