[Qt-interest] AmIRight: Can't Have Model and View on different Threads?

Stephen Kelly steveire at gmail.com
Thu Aug 13 08:07:01 CEST 2009


Arnold Krille wrote:

> Hi,
> 
> On Friday 07 August 2009 07:36:30 Hostile Fork wrote:
>> The short version is that I don't think it's feasible for a Model to
>> be modified on a non-GUI thread...regardless of whether the model's
>> data has been protected with read/write locks.   If what I'm gathering
>> is correct, then Qt should probably have an assert that a model and
>> its view have the same thread affinity (it doesn't seem to do that now)
> 
> I would find such an assert quite disturbing. Because here it works well
> to have models and views in different threads.

Can you say more about this? How does it work with QueuedConnections? What 
happens if a row gets added then removed, and because of the queue, the view 
only gets to process the added signal after the row has been removed?


Steve.

> Basically because the models are kind of read-only for the views. The
> views can change values, but they can't add or remove rows/columns. That
> is done by own functions.
> 
> Have fun,
> 
> Arnold




More information about the Qt-interest-old mailing list