tescik
10th June 2014, 08:55
Hi!
I have an app. stating a thread to do some calculations. This is code to start the thread and to connect the signals between the mainwindow and the thread:
m_calcProc = new BaseCalcProccess();
m_calcProc->moveToThread(&m_thread);
connect(&m_thread, SIGNAL(started()), m_calcProc, SLOT(run()));
connect(m_calcProc, SIGNAL(start()), &m_thread, SLOT(start()));
connect(m_calcProc, SIGNAL(stop()), &m_thread, SLOT(quit()));
m_calcProc->started();
the m_thread is a QThread variable defined in MainWindow
the class BaseCalcProccess is a "public QObject"
and for this class I have the follwing code:
void BaseCalcProccess::started()
{
m_threadData.LoopOn = true;
emit start();
}
void BaseCalcProccess::stopped()
{
m_threadData.LoopOn = false;
emit stop();
usleep(50000);
}
void BaseCalcProccess::run(void )
{
............
the code had been compiled with QtCreator 3.1.1 (based on Qt 5.2.1) and tested in ubuntu 13.10 without any problems!
Then I compiled with Qt 4.8.2 for embedded linux (ARM) and started the application in the target env. and everything is working as expected BUT the "started"-signal is not been triggered or at least, there is no call to the RUN-method for the BaseCalcProccess!!
I had been trying to find some explanations to this behaviour or some way to narrow down the problem without any success, so any advices, suggestions or help is much appreciated!
I have an app. stating a thread to do some calculations. This is code to start the thread and to connect the signals between the mainwindow and the thread:
m_calcProc = new BaseCalcProccess();
m_calcProc->moveToThread(&m_thread);
connect(&m_thread, SIGNAL(started()), m_calcProc, SLOT(run()));
connect(m_calcProc, SIGNAL(start()), &m_thread, SLOT(start()));
connect(m_calcProc, SIGNAL(stop()), &m_thread, SLOT(quit()));
m_calcProc->started();
the m_thread is a QThread variable defined in MainWindow
the class BaseCalcProccess is a "public QObject"
and for this class I have the follwing code:
void BaseCalcProccess::started()
{
m_threadData.LoopOn = true;
emit start();
}
void BaseCalcProccess::stopped()
{
m_threadData.LoopOn = false;
emit stop();
usleep(50000);
}
void BaseCalcProccess::run(void )
{
............
the code had been compiled with QtCreator 3.1.1 (based on Qt 5.2.1) and tested in ubuntu 13.10 without any problems!
Then I compiled with Qt 4.8.2 for embedded linux (ARM) and started the application in the target env. and everything is working as expected BUT the "started"-signal is not been triggered or at least, there is no call to the RUN-method for the BaseCalcProccess!!
I had been trying to find some explanations to this behaviour or some way to narrow down the problem without any success, so any advices, suggestions or help is much appreciated!