After unregisterResource , why still can use the resource
-
hi,
in my case , I want to dinamic Switch the resource.
so i have two rcc files, they have picture with same alias, like this
A.rcc
@
<RCC>
<qresource prefix="/">
<file alias="cover">a.png</file>
</qresource>
</RCC>
@B.rcc
@
<RCC>
<qresource prefix="/">
<file alias="cover">b.png</file>
</qresource>
</RCC>
@I first registerResource A.rcc , used a.png
then unregisterResource A.rcc
then,
@
Image { id: ttt }
...
ttt.source="qrc:/cover";
@
it works, used a.png . why???then,
registerResource B.rcc
still used a.png. why??? -
Is the image element created after the resource file is changed? Or is it created before?
If the Image element is persistent through the changing of the resource file, try briefly setting ttt.source="" and then resetting ttt.source="qrc:/cover" again. Does it then reload the proper image?
-
[quote author="mlong" date="1313012387"]Is the image element created after the resource file is changed? Or is it created before?
If the Image element is persistent through the changing of the resource file, try briefly setting ttt.source="" and then resetting ttt.source="qrc:/cover" again. Does it then reload the proper image? [/quote]
the image element created after the resource file is changed
-
I can Detailed description Process :
-
registerResource A.rcc
-
createQmlObject a Image_A created , used a.png in A.rcc
-
then, destroy Image_A and unregisterResource A.rcc
-
Next process, is Confusing. a new created Image_B can set source = "qrc:/cover" , it works used a.png
-
then I registerResource B.rcc . a new created Image_C set source = "qrc:/cover" , it works still used a.png . why?
btw, I write a plugin that can call registerResource and unregisterResource in QML.
-
-
Hi,
QML does a lot of caching behind the scenes, and images are one of the things that are cached. From your description it sounds like the cached image is what is continually being used, regardless of changing the underlying resource file.
QtQuick 1.1 (not yet released, but available as the HEAD of 4.7, or with the recent 4.8 pre-releases) adds a cache property to Image that should allow you to turn off this caching, which might solve your problem.
Regards,
Michael