QML:"NumberAnimation with foo" 语法 - 它是什么意思?
QML: "NumberAnimation with foo" syntax - what does it mean?
我开始在 Qt Creator 中编写 NumberAnimation 声明,并在自动完成框中得到了一些东西。其中之一是 "NumberAnimation with target"。这是否意味着有这样的语法:
NumberAnimation with foo {
// ...
}
您获得的自动完成建议是针对 Creator 的内置 snippets 之一。如果您选择了该选项(例如,通过按 Enter),您将获得此代码:
NumberAnimation {
target: object
property: "name"
duration: 200
easing.type: Easing.InOutQuad
}
您还可以在自动完成弹出窗口右侧的工具提示中看到代码的预览。
I think I have also seen this syntax used before [...]
你想到的语法大概是<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 }
}
对我来说,"number animation with target" 片段生成以下存根:
NumberAnimation {
target: object
property: "name"
duration: 200
easing.type: Easing.InOutQuad
}
IMO 这并不意味着存在 with
使用格式。此外,使用 with
实际上会导致语法错误。所以看起来不像是东西
我开始在 Qt Creator 中编写 NumberAnimation 声明,并在自动完成框中得到了一些东西。其中之一是 "NumberAnimation with target"。这是否意味着有这样的语法:
NumberAnimation with foo {
// ...
}
您获得的自动完成建议是针对 Creator 的内置 snippets 之一。如果您选择了该选项(例如,通过按 Enter),您将获得此代码:
NumberAnimation {
target: object
property: "name"
duration: 200
easing.type: Easing.InOutQuad
}
您还可以在自动完成弹出窗口右侧的工具提示中看到代码的预览。
I think I have also seen this syntax used before [...]
你想到的语法大概是<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 }
}
对我来说,"number animation with target" 片段生成以下存根:
NumberAnimation {
target: object
property: "name"
duration: 200
easing.type: Easing.InOutQuad
}
IMO 这并不意味着存在 with
使用格式。此外,使用 with
实际上会导致语法错误。所以看起来不像是东西