Stack¶
- component fbx.ui.page.Stack¶
Stack is a container object used to contain a stack of views in an application. Application may stack successive pages as if user was navigating its way in the application.
- property baseUrl¶
URL acting as a root of subsequent pushed URLs. After a page has beed pushed in the stack, subsequent pushes will be relative to top page URL.
- property duration¶
Duration (in milliseconds) of the transition animation between pages.
- property animation¶
Page animation. See
fbx.ui.controller.TransitionManager
for available transitions.
- property tip¶
Currently shown page item.
- property canPopRoot¶
Whether calling
pop()
will also pop the last page in stack, leaving the user with an empty stack.
- property depth¶
Count of pages currently in the stack.
- property initialPage¶
URL (absolute or relative to
baseUrl
) of the root page in stack. This is optional. If not set, stack will start empty.
- method push(url, defaults)¶
- Parameters
url (
string
) – An URL to add in the component cachedefaults (
object
) – Properties to assign to the new item
Adds an item to the end of the stack.
Item will be loaded from
url
.url
may be an absolute URL or relative tobaseUrl
property. Element found inurl
will be created with properties fromprops
.Optionally, initial page title can be set in
title
. Subsequent changes totitle
property in element will override initial title.
- method replace(url, defaults)¶
- Parameters
url (
string
) – An URL to add in the component cachedefaults (
object
) – Properties to assign to the new item
- method replaceAt(index, url, defaults)¶
- Parameters
index (
int
) – Index to replaceurl (
string
) – An URL to add in the component cachedefaults (
object
) – Properties to assign to the new item
Does an atomic
popTo()
thenpush()
. Pushed page will replace page at indexindex
.
- method pop()¶
Remove the current top of the stack.
- method popTo(index)¶
- Parameters
index (
int
) –
Removes items at top of stack in order to make stack item
index
new stack top.This example will pop to root of page stack:
popTo(0)
- property titleList¶
Current component list model
- property cacheSize¶
Count of cached page objects at top of stack
- method replaceAll(all)¶
Atomic equivalent for
popTo(-1); pushMany(all)
- method parentStack(level)¶
- Parameters
level (
int
) – Nested level count to walk through- Returns
A Page container object, if any
If there are nested stacks and pages, this allows to retrieve the surrounding stacks.
level
starts at 0 and corresponds to the current stack.
- method pushMany(all)¶
- Parameters
all (
list
) – A list of objects
Atomic equivalent for
push(url, defaults, title)
for all objects inall
.Example:
stack.pushMany([{url: "root.qml", title: "/"}, {url: "directory.qml", defaults: {name: "Home"}, title: "home"}, {url: "item.qml", defaults: {name: "myfile.txt"}}])
title is optional. defaults defaults to nothing set.