Setting Loader.active to false doesn't release item immediately

前端 未结 4 529
小鲜肉
小鲜肉 2020-12-22 09:05

I have a use case where depending on the presence or absence of a property value an object referencing it is either created or removed. I am using a Loader for

4条回答
  •  隐瞒了意图╮
    2020-12-22 09:24

    I came across this yesterday. I need two Loaders which share the same property. In C++ class, I update the two Loader's active property one by one, which will also lead to that problem. My solution for this is using a Binding and do some setting like this:

    Binding {
            target: contentItemAlias
            property: 'currentIndex'
            value: if (header.status == Loader.Ready) 
            header.item.currentIndex //ensure the current status is not null
            when: content.status === Loader.Ready // the content is ready
        }
    

    Actually maybe this will not help you, but this is the solution in my code. I hope you will see it and have a try at binding. Wish you success. here is the link to my project: https://github.com/begoat/qmlLive

提交回复
热议问题