vishal.chauhan
29th March 2007, 06:33
Hi All,
I m working on Qt 4.2.2 on my Intel Mac.
I m new to QThread.
I have a simple QThread program in which I have a call
class MyThread : public QThread
{
public:
void run();
};
and I m reimplementing the run as ..
void MyThread::run()
{
Form1 *myForm;
myForm->CallThread();
}
which is calling the CallThread function of the form1 class in which I m starting my Thread.
MyThread fileThread;
fileThread.start();
fileThread.wait();
If I donot use the wait the Thread will not start.
But now then thread is started and call the function
void Form1::CallThread()
{
QMessageBox::information(0,"Stellar Phoenix","I m in Thread calling Function");
}
and show the Message .
But my Question are
The Program is Get hanged after showing the Message and also give error in log that We can not use font and text outside the Gui Thread.
I have used flag to terminate the thread but its not working for me.
If anybody knows then plz help me.
Thanks.
I m working on Qt 4.2.2 on my Intel Mac.
I m new to QThread.
I have a simple QThread program in which I have a call
class MyThread : public QThread
{
public:
void run();
};
and I m reimplementing the run as ..
void MyThread::run()
{
Form1 *myForm;
myForm->CallThread();
}
which is calling the CallThread function of the form1 class in which I m starting my Thread.
MyThread fileThread;
fileThread.start();
fileThread.wait();
If I donot use the wait the Thread will not start.
But now then thread is started and call the function
void Form1::CallThread()
{
QMessageBox::information(0,"Stellar Phoenix","I m in Thread calling Function");
}
and show the Message .
But my Question are
The Program is Get hanged after showing the Message and also give error in log that We can not use font and text outside the Gui Thread.
I have used flag to terminate the thread but its not working for me.
If anybody knows then plz help me.
Thanks.