不知道如何表達我的問題。我的代碼片段只是為了說明我想在更大的代碼庫中實作什么。我有一個“originalCondition”,它改變了獨立于 SequentialAnimation 的影像的不透明度。在 SequentialAnimation 完成更改“originalCondition”系結回不透明度的影像的不透明度后,我想要實作的目標。不確定 bind 是否是描述它的合適方式
出于某種原因,這不會發生,我不知道為什么或如何做到這一點。
Item {
id: root
property bool activatedLetter: false
Button {
text: "Click me"
onClicked: root.activatedLetter = true
}
Image {
id: headerBackgroundImage
visible: true
opacity: originalCondition
}
SequentialAnimation {
running: root.activatedLetter
onStopped: {
if(root.activatedLetter) {
headerBackgroundImage.visible = true
}
headerBackgroundImage.opacity = 1
root.activatedLetter = false
}
PauseAnimation {
duration: 750
}
NumberAnimation {
target: headerBackgroundImage
property: "opacity"
from: 1
to: 0
duration: 1000
}
NumberAnimation {
target: headerBackgroundImage
property: "visible"
from: 1
to:0
duration: 1000
}
}
}
uj5u.com熱心網友回復:
在你的 onStopped 中,而不是這個:
headerBackgroundImage.opacity = 1
嘗試這個:
headerBackgroundImage.opacity = Qt.binding(() => originalCondition);
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/434932.html