Commit 4ac432ad authored by Richard Moe Gustavsen's avatar Richard Moe Gustavsen Committed by The Qt Project
Browse files

StackViewTransition: use 'item' instead of 'page' in the API


Change-Id: I6eedd4a8052fc23be248631929361326654d9534
Reviewed-by: default avatarJens Bache-Wiig <jens.bache-wiig@digia.com>
parent adf9b031
6.2 5.10 5.11 5.12 5.12.1 5.12.10 5.12.11 5.12.12 5.12.2 5.12.3 5.12.4 5.12.5 5.12.6 5.12.7 5.12.8 5.12.9 5.13 5.13.0 5.13.1 5.13.2 5.14 5.14.0 5.14.1 5.14.2 5.15 5.15.0 5.15.1 5.15.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 5.9.8 dev old/5.1 old/5.2 wip/calendar wip/tizen v5.15.0-alpha1 v5.14.1 v5.14.0 v5.14.0-rc2 v5.14.0-rc1 v5.14.0-beta3 v5.14.0-beta2 v5.14.0-beta1 v5.14.0-alpha1 v5.13.2 v5.13.1 v5.13.0 v5.13.0-rc3 v5.13.0-rc2 v5.13.0-rc1 v5.13.0-beta4 v5.13.0-beta3 v5.13.0-beta2 v5.13.0-beta1 v5.13.0-alpha1 v5.12.7 v5.12.6 v5.12.5 v5.12.4 v5.12.3 v5.12.2 v5.12.1 v5.12.0 v5.12.0-rc2 v5.12.0-rc1 v5.12.0-beta4 v5.12.0-beta3 v5.12.0-beta2 v5.12.0-beta1 v5.12.0-alpha1 v5.11.3 v5.11.2 v5.11.1 v5.11.0 v5.11.0-rc2 v5.11.0-rc1 v5.11.0-beta4 v5.11.0-beta3 v5.11.0-beta2 v5.11.0-beta1 v5.11.0-alpha1 v5.10.1 v5.10.0 v5.10.0-rc3 v5.10.0-rc2 v5.10.0-rc1 v5.10.0-beta4 v5.10.0-beta3 v5.10.0-beta2 v5.10.0-beta1 v5.10.0-alpha1 v5.9.9 v5.9.8 v5.9.7 v5.9.6 v5.9.5 v5.9.4 v5.9.3 v5.9.2 v5.9.1 v5.9.0 v5.9.0-rc2 v5.9.0-rc1 v5.9.0-beta4 v5.9.0-beta3 v5.9.0-beta2 v5.9.0-beta1 v5.9.0-alpha1 v5.8.0 v5.8.0-rc1 v5.8.0-beta1 v5.8.0-alpha1 v5.7.1 v5.7.0 v5.7.0-rc1 v5.7.0-beta1 v5.7.0-alpha1 v5.6.3 v5.6.2 v5.6.1 v5.6.1-1 v5.6.0 v5.6.0-rc1 v5.6.0-beta1 v5.6.0-alpha1 v5.5.1 v5.5.0 v5.5.0-rc1 v5.5.0-beta1 v5.5.0-alpha1 v5.4.2 v5.4.1 v5.4.0 v5.4.0-rc1 v5.4.0-beta1 v5.4.0-alpha1 v5.3.2 v5.3.1 v5.3.0 v5.3.0-rc1 v5.3.0-beta1 v5.3.0-alpha1 v5.2.1 v5.2.0 v5.2.0-rc1 v5.2.0-beta1 v5.2.0-alpha1 v5.1.1 v5.1.0 v5.1.0-rc2 v5.1.0-rc1 v5.1.0-beta1 v5.1.0-alpha1
No related merge requests found
Showing with 54 additions and 54 deletions
......@@ -870,33 +870,33 @@ Item {
__loadElement(transition.inElement)
transition.name = transition.replace ? "replaceTransition" : (transition.push ? "pushTransition" : "popTransition")
var enterPage = transition.inElement.item
transition.enterPage = enterPage
var enterItem = transition.inElement.item
transition.enterItem = enterItem
// Since an item can be pushed several times, we need to update its properties:
enterPage.parent = root
enterPage.Stack.__stackView = root
enterPage.Stack.__index = transition.inElement.index
__currentItem = enterPage
enterItem.parent = root
enterItem.Stack.__stackView = root
enterItem.Stack.__index = transition.inElement.index
__currentItem = enterItem
if (!transition.outElement) {
// A transition consists of two items, but we got just one. So just show the item:
enterPage.visible = true
__setStatus(enterPage, Stack.Activating)
__setStatus(enterPage, Stack.Active)
enterItem.visible = true
__setStatus(enterItem, Stack.Activating)
__setStatus(enterItem, Stack.Active)
return
}
var exitPage = transition.outElement.item
transition.exitPage = exitPage
if (enterPage === exitPage)
var exitItem = transition.outElement.item
transition.exitItem = exitItem
if (enterItem === exitItem)
return
if (root.delegate) {
transition.properties = {
"name":transition.name,
"enterPage":transition.enterPage,
"exitPage":transition.exitPage,
"enterItem":transition.enterItem,
"exitItem":transition.exitItem,
"immediate":transition.immediate }
var anim = root.delegate.getTransition(transition.properties)
if (anim.createObject) {
......@@ -910,13 +910,13 @@ Item {
console.warn("Warning: StackView: no", transition.name, "found!")
return
}
if (enterPage.anchors.fill || exitPage.anchors.fill)
if (enterItem.anchors.fill || exitItem.anchors.fill)
console.warn("Warning: StackView: cannot transition an item that is anchored!")
__currentTransition = transition
__setStatus(exitPage, Stack.Deactivating)
enterPage.visible = true
__setStatus(enterPage, Stack.Activating)
__setStatus(exitItem, Stack.Deactivating)
enterItem.visible = true
__setStatus(enterItem, Stack.Activating)
transition.animation.runningChanged.connect(animationFinished)
transition.animation.start()
// NB! For empty animations, "animationFinished" is already
......@@ -932,9 +932,9 @@ Item {
return
__currentTransition.animation.runningChanged.disconnect(animationFinished)
__currentTransition.exitPage.visible = false
__setStatus(__currentTransition.exitPage, Stack.Inactive);
__setStatus(__currentTransition.enterPage, Stack.Active);
__currentTransition.exitItem.visible = false
__setStatus(__currentTransition.exitItem, Stack.Inactive);
__setStatus(__currentTransition.enterItem, Stack.Active);
__currentTransition.properties.animation = __currentTransition.animation
root.delegate.transitionFinished(__currentTransition.properties)
......
......@@ -44,17 +44,17 @@ ParallelAnimation {
id: root
/*! The name of the animation that is running. Can be one of the following:
\list
\li 'PushAnimation'
\li 'PopAnimation'
\li 'ReplaceAnimation'
\li 'PushTransition'
\li 'PopTransition'
\li 'ReplaceTransition'
\endlist
*/
property string name
/*! The page that is transitioning in. */
property Item enterPage
property Item enterItem
/*! The page that is transitioning out */
property Item exitPage
/*! Set to \c true if the animation is told to
property Item exitItem
/*! Set to \c true if the transition is told to
fast-forward directly to its end-state */
property bool immediate
}
......@@ -58,21 +58,21 @@ StackViewDelegate {
function transitionFinished(properties)
{
properties.exitPage.x = 0
properties.exitPage.y = 0
properties.exitItem.x = 0
properties.exitItem.y = 0
}
property QtObject horizontalSlide: QtObject {
property Component pushTransition: StackViewTransition {
PropertyAnimation {
target: enterPage
target: enterItem
property: "x"
from: target.width
to: 0
duration: 300
}
PropertyAnimation {
target: exitPage
target: exitItem
property: "x"
from: 0
to: -target.width
......@@ -82,14 +82,14 @@ StackViewDelegate {
property Component popTransition: StackViewTransition {
PropertyAnimation {
target: enterPage
target: enterItem
property: "x"
from: -target.width
to: 0
duration: 300
}
PropertyAnimation {
target: exitPage
target: exitItem
property: "x"
from: 0
to: target.width
......@@ -102,14 +102,14 @@ StackViewDelegate {
property QtObject verticalSlide: QtObject {
property Component pushTransition: StackViewTransition {
PropertyAnimation {
target: enterPage
target: enterItem
property: "y"
from: target.height
to: 0
duration: 300
}
PropertyAnimation {
target: exitPage
target: exitItem
property: "y"
from: 0
to: -target.height
......@@ -119,14 +119,14 @@ StackViewDelegate {
property Component popTransition: StackViewTransition {
PropertyAnimation {
target: enterPage
target: enterItem
property: "y"
from: -target.height
to: 0
duration: 300
}
PropertyAnimation {
target: exitPage
target: exitItem
property: "y"
from: 0
to: target.height
......
......@@ -55,19 +55,19 @@ Window {
property StackViewDelegate fadeTransition: StackViewDelegate {
function transitionFinished(properties)
{
properties.exitPage.visible = false
properties.exitPage.opacity = 1
properties.exitItem.visible = false
properties.exitItem.opacity = 1
}
property Component pushTransition: StackViewTransition {
PropertyAnimation {
target: enterPage
target: enterItem
property: "opacity"
from: 0
to: 1
}
PropertyAnimation {
target: exitPage
target: exitItem
property: "opacity"
from: 1
to: 0
......@@ -78,33 +78,33 @@ Window {
property StackViewDelegate rotateTransition: StackViewDelegate {
function transitionFinished(properties)
{
properties.exitPage.x = 0
properties.exitPage.rotation = 0
properties.exitItem.x = 0
properties.exitItem.rotation = 0
}
property Component pushTransition: StackViewTransition {
SequentialAnimation {
ScriptAction {
script: enterPage.rotation = 90
script: enterItem.rotation = 90
}
PropertyAnimation {
target: enterPage
target: enterItem
property: "x"
from: enterPage.width
from: enterItem.width
to: 0
}
PropertyAnimation {
target: enterPage
target: enterItem
property: "rotation"
from: 90
to: 0
}
}
PropertyAnimation {
target: exitPage
target: exitItem
property: "x"
from: 0
to: -exitPage.width
to: -exitItem.width
}
}
}
......@@ -112,21 +112,21 @@ Window {
property StackViewDelegate slideTransition: StackViewDelegate {
function transitionFinished(properties)
{
properties.exitPage.x = 0
properties.exitItem.x = 0
}
property Component pushTransition: StackViewTransition {
PropertyAnimation {
target: enterPage
target: enterItem
property: "x"
from: enterPage.width
from: enterItem.width
to: 0
}
PropertyAnimation {
target: exitPage
target: exitItem
property: "x"
from: 0
to: exitPage.width
to: exitItem.width
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment