我已经通过了Qt文档:Qt StackView但我仍然无法弄清楚我做错了什么,因为我的代码应该会产生淡入/淡出动画,但是我得到的只是瞬间闪烁内容。我希望我的描述足够清楚。QML StackView自定义转换
StackView {
id: stackView
anchors.fill: parent
delegate: StackViewDelegate {
function transitionFinished(properties)
{
properties.exitItem.opacity = 1
}
property Component pushTransition: StackViewTransition {
PropertyAnimation {
target: enterItem
property: "opacity"
from: 0
to: 1
duration: 10
}
PropertyAnimation {
target: exitItem
property: "opacity"
from: 1
to: 0
duration: 10
}
}
}
initialItem: Item {
width: parent.width
height: parent.height
ListView {
model: pageModel
anchors.fill: parent
delegate: AndroidDelegate {
text: title
onClicked: stackView.push(Qt.resolvedUrl(page))
}
}
}
}
其实,我发现transitionFinished在我的情况下工作。 – Nadarian