Hi,
I am writing a sample which uses thread to do some background processing.
In the thread I am trying to emitting a signal. But it is not coming to slot.
While connecting I checked the value of “connect()” function value , it is returning value as true.
One thing to notice is in the run method I am not using “exec() “ .
Please help me to solve this problem.
class MyThread : public QThread
{
Q_OBJECT
public:
void run( void )
{
while (true)
{
emit updateStatus();
}
}
signals:
void updateStatus();
};
class test: public QObject
{
Q_OBJECT
public :
void test
{
connect(&thread, SIGNAL(updateStatus()),this, SLOT(update()));
thread.start();
}
public slots:
void update()
{
//display
}
private:
MyThread thread;
};