[Interest] QML StackView: cannot push while already in the process of completing a push

Alexander Dyagilev alervdvcw at gmail.com
Wed Jul 22 04:44:01 CEST 2020


This workaround works:

importQtQuick2.0

importQtQuick.Controls2.12

StackView

{

propertyvarqueue:[]

functionwaPush(item,properties,operation){

if(queue.length||

!push(item,properties,operation))

{

queue.push({i:item,p:properties,o:operation});

applyTimer();

}

}

functionwaClear(){

queue=[];

clear();

applyTimer();

}

functioncheckQueue(){

while(queue.length)

{

varitem=queue.shift();

if(!push(item.i,item.p,item.o))

{

queue.unshift(item);

break;

}

}

applyTimer();

}

Timer

{

id:checkQueueTimer

interval:100

repeat:true

onTriggered:checkQueue()

}

functionapplyTimer(){

if(queue.length)

checkQueueTimer.start();

else

checkQueueTimer.stop();

}

}

On 7/22/2020 4:31 AM, Alexander Dyagilev wrote:
>
> Hello,
>
> Qt 5.12.8, Android 10.
>
> We're getting the subject message in app log when trying to push an 
> item in some occasions. And thus the item is not pushed.
>
> Is it a bug? We've tried to use this custom component with no luck:
>
> importQtQuick2.0
>
> importQtQuick.Controls2.12
> StackView
> {
> propertyvarqueue:[]
> functionqueuedPush(item,properties,operation){
> varpushedOk=false;
> if(!isBusy())
> {
> if(push(item,properties,operation))
> pushedOk=true;
> }
> if(!pushedOk)
> {
> console.log("queuingitem");
> queue.push({i:item,p:properties,o:operation});
> }
> }
> functionqueuedClear(){
> queue=[];
> clear();
> }
> functionisBusy(){
> returnbusy||state==StackView.Deactivating||state==StackView.Activating;
> }
> functioncheckQueue(){
> console.log("checkingqueue");
> if(!isBusy()&&!queue.empty){
> console.log("pushing...");
> varitem=queue.shift();
> push(item.i,item.p,item.o);
> }
> }
> onBusyChanged:checkQueue()
> onStateChanged:checkQueue()
> }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200722/a1159d67/attachment.html>


More information about the Interest mailing list