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

Peter Devoy peter at 3xe.co.uk
Thu Oct 5 06:25:22 PDT 2017


Just a little update; it is the fact I am using print() to output
debug information upon each request which is allowing the UI to
repaint.  Also, it seems that opening and closing the Python console
once is enough.

Peter

3XE
P: 01326 567155
M: 07770 693662
A: 3XE Ltd
Tremough Innovation Centre
PENRYN
TR10 9TA
3XE Ltd · Registered in England and Wales · 9356871


On 4 October 2017 at 20:53, Peter Devoy <peter at 3xe.co.uk> wrote:
> 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