[Interest] QSqlQuery

Mark Brand mabrand at mabrand.nl
Sun Jan 26 22:17:47 CET 2014


On 01/26/2014 07:45 PM, arno wrote:
> Hi Igor,
>
> On 26-Jan-14 4:29 PM, Igor Mironchik wrote:
>> I have some questions about database support in Qt 5.
>>
>> First of all, is it safe to transfer a QSqlQuery instance from one
>> thread to another to process him in another thread. I.e. I want to
>> execute SELECT query on "DB" thread and return a QSqlQuery from that
>> thread to the GUI thread, where I will navigate and show users the
>> result of the query.
> Hmm, why do you want to return the Query to the GUI thread? Update the
> Model from the thread executing the Query and let QT take care of the GUI.
>

If the suggestion is that the QSql*Model in one thread should be 
connected to a QAbstractItemView in another thread, I'm afraid this is 
not good advice. The interface between model and view is not designed 
for asynchronous communication. Even if it seems to work at first, it's 
sure to end in grief.

Mark



More information about the Interest mailing list