QQuickImageProvider force image to be updated. How to?
-
Hi. I have
QQuickImageProvider
and I need to keep image in sync in QML with source set to thisQQuickImageProvider
to be updated in case of its source changes.
How to do this? I ask becauseQQuickImageProvider
does not have any signals or to indicate that source changed.
What is the benefit of usingQQuickImageProvider
instead ofP_PROPERTY(QImage image... )
which signals about changes? -
@Kofr said in QQuickImageProvider force image to be updated. How to?:
What is the benefit of using QQuickImageProvider instead of P_PROPERTY(QImage image... ) which signals about changes?
the benefits are well described in the class description.
As the classname says it's supposed to provide images. The images do not necessarily exist. For example you could create pixmaps on the fly specified by url parameters.
You need to create a separate QObject which keeps track of the images and triggers when you want it to. the image provider is still needed though. But in QML you could request the image url via your custom object which then also registers to trigger updates when it changes for example.