[PyQt] Multithreaded Update of the QStandardItemModel Data

Christian Schulze c.schulze at tlk-thermo.com
Mon Mar 12 20:59:11 GMT 2018


Hello,


I'm trying to update the QStandardItemModel data from another thread. This causes several issues:

1.       The error message:
QObject::connect: Cannot queue arguments of type 'QVector<int>'

(Make sure 'QVector<int>' is registered using qRegisterMetaType().)

QObject::connect: Cannot queue arguments of type 'QVector<int>'

(Make sure 'QVector<int>' is registered using qRegisterMetaType().)

QObject::connect: Cannot queue arguments of type 'QVector<int>'

(Make sure 'QVector<int>' is registered using qRegisterMetaType().)

2.       Not all changes are applied. Namely the number of items in the TreeView changes, e.g. if I resize the window.

3.       Often the python.exe crashes on windows
It would be great if someone could tell me how to fix this!



Attached you find a simple (complete) example that illustrates the issues. Tested with Anaconda Python 2/3 and PyQt5.

The first issue seems to occur if a QStandardItem from the item model is modified from the second thread (:45). Adding new items seems to work fine.

The 2. issue suggests that I didn't delete some item. But how could I check if removing the row was successful?

Maybe the 3. issue could be related to some event buffer overflow?


Best regards,
Christian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20180312/b36cfa6e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MultithreadedItemModelUpdate.py
Type: application/octet-stream
Size: 2199 bytes
Desc: MultithreadedItemModelUpdate.py
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20180312/b36cfa6e/attachment-0001.obj>


More information about the PyQt mailing list