[QGIS-Developer] Qt Model-View updates blocked when Python console not open

Peter Devoy peter at 3xe.co.uk
Wed Oct 4 12:53:59 PDT 2017


Hi all

In my plugin I have extended QAbstractListModel to create a list of
objects; each object in the list has a 'url' property containing the
URL of an API resource.  When the user selects a feature in main QGIS
interface, each object in the list makes a HTTP request to its URL and
updates its properties from the response data.

Changes in the objects' properties are reflected in a QListView.  E.g.
a  property 'status'  is set to 'WARN' if the HTTP request fails --
this is reflected in the QListView by the respective list item's icon
turning yellow.

If I have the Python console open in QGIS the QListView items update
as the ListModel's objects update. However, if the Python console is
not open, the plugin's UI thread appears to be blocked until each item
in the list has completed its changes and all the items update at
once; please can anyone recommend a way to avoid this?

I have been developing on QGIS 2.1X.

Kind regards


Peter


More information about the QGIS-Developer mailing list