Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 3

Qt-interest Archive, April 2007
Use QThread in qt-3.1


Message 1 in thread

hi,

Good morining.


I want to use Qthread in my .ui.h  file like as follows,


class GuiThread:public QThread
{
public:

 void run()
 {


 }



};


When compiled the project with QT_THREAD_SUPPORT, it will me error like

/usr/lib/qt-3.1/include/qthread.h:60: parse error before `void'


What's the problem???




Thanks and Regards,
Niranjan

--
 [ signature omitted ] 

Message 2 in thread

Hi,

> When compiled the project with QT_THREAD_SUPPORT, it will me error like
> 
> /usr/lib/qt-3.1/include/qthread.h:60: parse error before `void'

What's exactly in line 60? I don't have Qt 3.1 available right now.

> What's the problem???

Are you using qmake and *.pro files? If so, add to the *.pro file:
	CONFIG += thread

--
 [ signature omitted ] 

Message 3 in thread

niranjank@xxxxxxxxxxxx wrote:
> class GuiThread:public QThread

It appears you want to use this new thread class for GUI things. Be 
careful with that, in Qt most GUI elements can be accessed from only 
from one thread - the thread that runs the event loop.

Martin.

--
 [ signature omitted ]