Ste*_*nov 0 syntax qt keyword qml qtquick2
我开始在Qt Creator中编写一个NumberAnimation声明,并在自动完成框中得到了一些东西.其中一个是"NumberAnimation with target".这是否意味着有这样的语法:
NumberAnimation with foo {
// ...
}
Run Code Online (Sandbox Code Playgroud)
您获得的自动完成建议是针对Creator的内置代码段之一.如果您选择了该选项(Enter例如,通过点击),您将获得以下代码:
NumberAnimation {
target: object
property: "name"
duration: 200
easing.type: Easing.InOutQuad
}
Run Code Online (Sandbox Code Playgroud)
您还可以在自动完成弹出窗口右侧的工具提示中看到它将展开的代码预览.
我想我之前也看过这种语法[...]
您正在考虑的语法可能是<Animation> on <Property>:
import QtQuick 2.0
Rectangle {
id: rect
width: 100; height: 100
color: "red"
PropertyAnimation on x { to: 100 }
PropertyAnimation on y { to: 100 }
}
Run Code Online (Sandbox Code Playgroud)