[Interest] What is the best way to refresh QML image

VStevenP vstevenpavao at yahoo.com
Tue Mar 10 18:32:35 CET 2015


Hi Harry,

If you want a low-tech, QML-only workaround, perhaps you could have 2 Images at the same location with the same dimensions, and just switch between them when a refresh occurs.

You could stage the refreshed picture into the currently invisible, source-less Image, then set it to visible, then on the other Image you could set visible to false and source string to a null string.  You could also swap the Images z values at this time, to make the currently invisible one always be "behind" the currently visible one.  That would avoid any flicker during the switching between Images.

I'm thinking this is probably not so inefficient, because most of the time, only one Image would be visible.

- VStevenP
Steve Pavao
Korg R&D

----

Message: 3
Date: Tue, 10 Mar 2015 11:47:39 +0100
From: Harri Pasanen <harri at mpaja.com>
Subject: Re: [Interest] What is the best way to refresh QML image
To: Daniel Fran?a <daniel.franca at gmail.com>,    "interest at qt-project.org"
    <interest at qt-project.org>
Message-ID: <54FECBCB.2010008 at mpaja.com>
Content-Type: text/plain; charset="utf-8"

Exactly: I want QML Image to have a refresh() method that will force it 
to reload the image.

One use case:  let's say I have a jpg on disk that I'm showing in QML.
If I edit the image in an external application and save it again with 
the same name,
I'd like to be able to reload the image without changing the source name.



More information about the Interest mailing list