Is it possible to queue events in QML?
-
wrote on 3 Feb 2022, 16:54 last edited by RobM 2 Mar 2022, 16:56
So I have a single button which is controlling the closing of multiple screens which are are technically available at the same time. The problem I am running into is having multiple screens open and layered on top of one another. For instance, the user clicks a button which will open a screen and display some details but while viewing this screen they still have the ability to open another on top of the one they are viewing but both screens need to use the same button in order to close.
So, I am trying to figure out how to tell the close button that the user is attempting to close the screen they last opened rather than the first one? I thought perhaps if I could queue these "events" then the close button could simply de-queue the last event rather than closing a specific screen. Is there any queue type system in QML that I could use without using C++ if not than does anyone have an suggestions for how I could handle this?
-
wrote on 4 Feb 2022, 07:34 last edited by
Maybe you take a took at Ben Laus Flux implementation for QML.
This could meet your requirements and also offers a decent structure for growing applications.
https://github.com/benlau/quickflux -
wrote on 4 Feb 2022, 22:36 last edited by
I believe that a basic
property var screenQueue: []
is going to work just fine. It won't be as verbose as a fully implemented queue but it will do the trick. -
Or use StackView, push or replace pages onto it and pop them when needed.
1/4