How to clear or delete Image in QML
-
Hello.
How to clear or delete Image in QML?I'd like to make the application.
it likes "slide show" application.example
Image { id: mPicture } Timer { interval: 2000 running: true repeat: true property var fList //it has many imagefile path ex. aaa.png, bbb.png... property int nextIdx onTriggered:{ mPicture.source = "file://" + fList[nextIdx] nextIdx++ if(fList.length <= nextIdx) { nextIdx = 0 } } }It's working.
but few minutes later application will down.
I think I have to clear or delete mPicture.source.I already try it.
mPicture.source = "" mPicture.source = "file://" + fList[nextIdx]But it's same.
Could you let me know how should I do?
thanks. -
Hello.
How to clear or delete Image in QML?I'd like to make the application.
it likes "slide show" application.example
Image { id: mPicture } Timer { interval: 2000 running: true repeat: true property var fList //it has many imagefile path ex. aaa.png, bbb.png... property int nextIdx onTriggered:{ mPicture.source = "file://" + fList[nextIdx] nextIdx++ if(fList.length <= nextIdx) { nextIdx = 0 } } }It's working.
but few minutes later application will down.
I think I have to clear or delete mPicture.source.I already try it.
mPicture.source = "" mPicture.source = "file://" + fList[nextIdx]But it's same.
Could you let me know how should I do?
thanks.@nishiokas most likly you indexing
fListwrong and outrun the length.However I would suggest taking a look the the SlideShow-Example from the docs.
That should help you more.
-
Simply updating the
mPicture.sourceshould be sufficient to release any resources consumed by the previously displayed image; there's no need for any additional code to explicitly "clear" it.What's the exact nature of "application will down"? Do you get an error message on the console? If it's a crash, where does a stack-trace say it crashes?