[Interest] QSqlDatabase and Multithreading

Thiago Macieira thiago.macieira at intel.com
Wed Jan 22 16:44:07 CET 2014


On quarta-feira, 22 de janeiro de 2014 18:48:53, Soroush Rabiei wrote:
> A connection can only be used from within the thread that created it.
> Moving connections between threads or creating queries from a different
> thread is not supported.
> My question is how can I make connections between UI and second thread?

You may want to look at the producer-consumer QThread examples. You can pass 
the data in mutex-protected queues or by way of signals & slots.

Just be careful that if you use slots, your class should not derive from 
QThread.
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140122/3c43f141/attachment.sig>


More information about the Interest mailing list