Skip to content

sipke/qml_pyside2_editable_list_view

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pyside2 and QML example

Editable ListView from PySide using Python Thread

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published