[Qt-interest] Is QAbstractItemModel thread safe?
Arnold Krille
arnold at arnoldarts.de
Mon Jun 29 22:55:13 CEST 2009
On Monday 29 June 2009 22:03:25 Eric Clark wrote:
> I was just wondering if it is safe to call functions in the
> QAbstractItemModel class from a thread that is different than the main GUI
> thread?
The real question is whether you can call functions from QAbstractItemModel
from any thread != QAbstractItemModel::thread() :-)
And at least from expierience I can say that it is. I have several models in
their own thread and access each of them with two views (naturally in the gui-
thread) and this runs well for hours (in the range of 4-7 days:).
The docs say that it is at least re-entreant. And I think the communication
with the views is mostly done with signals/slots and these are sent as events
when crossing threads. BTW: You have to do Q_DECLARE_METATYPE( QModelIndex
)...
Have fun,
Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090629/803b38ca/attachment.bin
More information about the Qt-interest-old
mailing list