Hi,
I'm building a server application that has multiple sources of input and needs to run queries in the background. I have following design:
DataSession: QObject - this class adds queries into QQueue and wakes QueryCommiter class, which is derived from QThread and runs queries.
Next class is EfsSqlQuery, derived from QObject, containing 1 QSqlQuery object, and one method, exec(), which runs the query and emits signal commited().

The question is, I want to catch the signal in my server application like this:
Qt Code:
  1. connect(m_query.data(), SIGNAL(commited(bool)), this, SLOT(process_stage_2(bool)));
To copy to clipboard, switch view to plain text mode 
and then call
Qt Code:
  1. dataSession.commitQuery(m_query);
To copy to clipboard, switch view to plain text mode 
which, as I described above, adds query to the queue and notifies the QueryCommiter class, that calls exec method of QSqlQuery and emits the signal.

The slot(process_stage_2(bool)) is never executed, though. But the SIGNAL IS emitted in the EfsSqlQuery!

I'll try to attach some relevant code:
Server code:
Qt Code:
  1. connect(m_query.data(), SIGNAL(commited(bool)), this, SLOT(process_stage_2(bool)));
  2.  
  3. dataSession.commitQuery(m_query);
To copy to clipboard, switch view to plain text mode 

DataSession code:
Qt Code:
  1. void sk_efs_server::DataSession::commitQuery(QSharedPointer<EfsSqlQuery> query)
  2. {
  3. sqlMutex->lock();
  4. sqlQueue->append(query);
  5. sqlMutex->unlock();
  6.  
  7. sqlQueueFull->wakeAll();
  8. }
To copy to clipboard, switch view to plain text mode 

QueryCommiter code:
Qt Code:
  1. void sk_efs_server::QueryCommiter::run()
  2. {
  3. QSharedPointer<EfsSqlQuery> query;
  4.  
  5. forever
  6. {
  7. sqlMutex->lock();
  8. sqlQueueFull->wait(sqlMutex.data());
  9. query = sqlQueue->dequeue();
  10. sqlMutex->unlock();
  11.  
  12. query->exec();
  13. }
  14.  
  15. exec();
  16. }
To copy to clipboard, switch view to plain text mode 

EfsSqlQuery code:
Qt Code:
  1. bool sk_efs_server::EfsSqlQuery::exec()
  2. {
  3. bool cted = m_query->exec();
  4.  
  5. emit commited(cted);
  6.  
  7. return cted;
  8. }
To copy to clipboard, switch view to plain text mode 

Why is the signal never caught in my server thread even though it is emmited by EfsSqlQuery?

Thanks in advance.