我已經通過了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