This is a port of Stack Overflow post Editable qml/pyside2 listview from PyQt5 to PySide2
Adding or removing from the UI works nicely and the ListView updates.
Doing the same from a timer using python Threading does not, as demonstrated by the update function in main.py (when queue variable is False).
The stack overflow site SO Qt Queued Connection and associated Gist Qt Queued Connection explain that QueuedConnections are necessary.
To compare between the two methods, change the variable queued between True or False at the start of the main.py script.
queued = False # Change between False and True to test direct (which does not auto update) or queued signal (which does)
The Link class and the associated signal emit call are the key behind successful update of the UI from a thread.
link = Link()
link.updateSignal.connect(ui.model.addPerson, Qt.QueuedConnection) # This line ...
...
link.updateSignal.emit("queued", age) # ... and this line are the key
Stack Overflow Links
Associated Authors
Gist Links