resetting state when my page is pop()-ed

Marco Martin notmart at gmail.com
Mon Feb 8 13:29:12 UTC 2016


On Saturday 06 February 2016, Dirk Hohndel wrote:
> We are using the mobile components for an Android application.
> 
> One of the features we get by default from the components is that when the
> user presses the Android BACK key the top page is pop()-ed from the stack.
> 
> Is there a way to get a call back when that happens? So something like
> 
> onPagePopped: { resetState() }

ok, so I added something in master that should be useful for you:
in the root of your page you do:

Page {

onBackRequested: {
        if (//edit mode condition) {
            event.accepted = true;
            //go out of edit mode
        }
    }
  [...]
}

 event.accepted = true; stops the application to do the pop.

-- 
Marco Martin


More information about the Plasma-devel mailing list