qt - 将动画应用于 InputPanel QML 类型的问题
问题描述
我有以下输入面板:
InputPanel{
id: inputPanel
visible: false
y : window.height/2
width: window.width
height: window.height/2
transitions: Transition {
NumberAnimation {
target: inputPanel
property: "height"
duration: 500
easing.type: Easing.InOutQuad
}
}
}
但是NumberAnimation没有效果,SmoothedAnimation、PathAnimation和SequentialAnimation也是如此。
我使用 Qt 5.14
任何帮助表示赞赏。
解决方案
你想要一个行为。
InputPanel {
Behavior on width {
NumberAnimation {
duration: 2000
}
}
width: 400
active: true
}
正如 folibis 所提到的,转换是为了状态变化。
推荐阅读
- javascript - TypeError:无法读取未定义的属性“whenReady”
- kotlin - 未解决的参考:removeAt()
- c# - 如何获得所有字符串“可能性”
- node.js - 在 Vercel 上部署服务器
- spring-boot - @JmsListener 不异步接收消息
- java - 如何在Java中获取两个日期之间的月份列表
- reactjs - 使用 useEffect 向 api 端点发送 get 请求未获取数据
- image - 在flutter中将“html”类型文件转换为“io”类型文件
- facebook - Facebook 分享爬虫不显示 OG:说明
- javascript - 仅当 currentState 为空时显示选项