Obsolete Members for StackView
The following members of QML type StackView are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.
Methods
- void clear()
- void completeTransition()
- Item find(function, bool onlySearchLoadedItems)
- Item get(int index, bool dontLoad)
- Item pop(Item item)
- Item push(Item item)
Method Documentation
Search for a specific item inside the stack. func will be called for each item in the stack (with the item as argument) until the function returns true. Return value will be the item found. For example: find(function(item, index) { return item.isTheOne }) Set onlySearchLoadedItems to true to not load items that are not loaded into memory
Returns the item at position index in the stack. If dontLoad is true, the item will not be forced to load (and null will be returned if not yet loaded)
Pops one or more items off the stack.
The function can also take a property list as argument - Item StackView::pop(jsobject dict), which can contain one or more of the following properties:
item: if specified, all items down to (but not including) item will be popped off. If item isnull, all items down to (but not including) the first item will be popped. If not specified, only the current item will be popped.immediate: set this property totrueto skip transition effects.
Examples:
- stackView.pop()
- stackView.pop({item:someItem, immediate: true})
- stackView.pop({immediate: true})
- stackView.pop(null)
Note: If the only argument needed is "item", you can apply the following short- hand notation: stackView.pop(anItem).
Returns the item that was popped off
See also clear().
Pushes an item onto the stack.
The function can also take a property list as argument - Item StackView::push(jsobject dict), which should contain one or more of the following properties:
item: this property is required, and holds the item you want to push.properties: a list of QML properties that should be assigned to the item upon push. These properties will be copied into the item when it is loaded (in case of a component or URL), or when it becomes the current item for the first time (normally upon push).immediate: set this property totrueto skip transition effects. When pushing an array, you only need to set this property on the first element to make the whole operation immediate.replace: set this property to replace the current item on the stack. When pushing an array, you only need to set this property on the first element to replace as many elements on the stack as inside the array.destroyOnPop: set this property to specify if the item needs to be destroyed when its popped off the stack. By default (if destroyOnPop is not specified), StackView will destroy items pushed as components or URLs. Items not destroyed will be re-parented to the original parents they had before being pushed onto the stack, and hidden. If you need to set this property, do it with care, so that items are not leaked.
You can also push an array of items (property lists) if you need to push several items in one go. A transition will then only occur between the current item and the last item in the list. Loading the other items will be deferred until needed.
Examples:
- stackView.push({item:anItem})
- stackView.push({item:aURL, immediate: true, replace: true})
- stackView.push({item:aRectangle, properties:{color:"red"}})
- stackView.push({item:aComponent, properties:{color:"red"}})
- stackView.push({item:aComponent.createObject(), destroyOnPop:true})
- stackView.push([{item:anitem, immediate:true}, {item:aURL}])
Note: If the only argument needed is "item", you can apply the following short- hand notation: stackView.push(anItem).
Returns the item that became current.
See also initialItem and Pushing items.