QQmlSA::Binding Class
class QQmlSA::Binding表示针对特定类型的单个 QML 属性绑定。更多内容...
| 标题: | #include <qqmlsa.h> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS QmlCompiler) target_link_libraries(mytarget PRIVATE Qt6::QmlCompiler) |
| 状态: | 技术预览版 |
该类目前处于技术预览阶段,内容可能会有变动。
公共类型
(technology preview) class | Bindings |
公共函数
| Binding() | |
| Binding(const QQmlSA::Binding &other) | |
| Binding(QQmlSA::Binding &&other) | |
| ~Binding() | |
| QQmlSA::Element | attachedType() const |
| QQmlSA::Element | bindingScope() const |
| QQmlSA::BindingType | bindingType() const |
| QQmlSA::Element | groupType() const |
| bool | hasFunctionScriptValue() const |
| bool | hasObject() const |
| bool | hasUndefinedScriptValue() const |
| bool | isAttached() const |
| double | numberValue() const |
| QQmlSA::Element | objectType() const |
| QString | propertyName() const |
| QQmlSA::ScriptBindingKind | scriptKind() const |
| QQmlSA::SourceLocation | sourceLocation() const |
| QString | stringValue() const |
| QQmlSA::Binding & | operator=(QQmlSA::Binding &&other) |
| QQmlSA::Binding & | operator=(const QQmlSA::Binding &other) |
静态公共成员
| bool | isLiteralBinding(QQmlSA::BindingType bindingType) |
相关的非成员
| bool | operator!=(const QQmlSA::Binding &lhs, const QQmlSA::Binding &rhs) |
| bool | operator==(const QQmlSA::Binding &lhs, const QQmlSA::Binding &rhs) |
成员函数文档
Binding::Binding()
创建一个新的 Binding 对象。
Binding::Binding(const QQmlSA::Binding &other)
创建other 的副本。
[noexcept] Binding::Binding(QQmlSA::Binding &&other)
通过移动构造创建一个Binding 实例。
[noexcept] Binding::~Binding()
解除绑定。
QQmlSA::Element Binding::attachedType() const
如果此绑定的内容类型为AttachedProperty ,则返回关联的类型;否则返回一个无效的Element。
QQmlSA::Element Binding::bindingScope() const
返回定义该绑定的 Element 作用域。
QQmlSA::BindingType Binding::bindingType() const
返回此绑定的类型。
QQmlSA::Element Binding::groupType() const
如果该绑定属性为组属性,则返回该属性的类型;否则返回一个无效的 Element。
bool Binding::hasFunctionScriptValue() const
返回该绑定是否具有脚本值类型函数,例如当其被赋予 (lambda) 方法、箭头函数或语句块时。如果该绑定的内容类型不是QQmlSA::BindingType::Script ,则返回false 。
bool Binding::hasObject() const
如果该绑定包含对象,则返回true ;否则返回false 。
bool Binding::hasUndefinedScriptValue() const
返回该绑定是否具有脚本值类型为“undefined”(例如当其被赋值为undefined 时)。如果该绑定的内容类型不是QQmlSA::BindingType::Script ,则返回false 。
bool Binding::isAttached() const
如果该类型已附加到另一个类型上,则返回true ;否则返回false 。
[static] bool Binding::isLiteralBinding(QQmlSA::BindingType bindingType)
如果 `bindingType ` 是字面量类型,则返回 `true `;否则返回 `false `。
double Binding::numberValue() const
如果此绑定的内容类型为NumberLiteral ,则返回相应的编号;否则返回 0。
QQmlSA::Element Binding::objectType() const
如果此绑定的内容类型为 Object,则返回关联对象的类型;否则,返回一个无效的 Element。
QString Binding::propertyName() const
返回与该绑定关联的属性名称。
QQmlSA::ScriptBindingKind Binding::scriptKind() const
如果此绑定的内容类型为 Script,则返回关联脚本的类型;否则返回 Invalid。
QQmlSA::SourceLocation Binding::sourceLocation() const
返回 QML 代码中定义此绑定的位置。
QString Binding::stringValue() const
如果此绑定的内容类型为StringLiteral ,则返回相应的字符串字面量;否则返回空字符串。
[noexcept] QQmlSA::Binding &Binding::operator=(QQmlSA::Binding &&other)
将 `other ` 通过 `move-assign` 赋值给此 `Binding` 实例。
QQmlSA::Binding &Binding::operator=(const QQmlSA::Binding &other)
将other 分配给此绑定实例。
相关的非成员
bool operator!=(const QQmlSA::Binding &lhs, const QQmlSA::Binding &rhs)
如果lhs 和rhs 不相等,则返回true ;否则返回false 。两个Bindings 对象在属性名称、内容类型和源位置匹配时被视为相等。
bool operator==(const QQmlSA::Binding &lhs, const QQmlSA::Binding &rhs)
如果lhs 和rhs 相等,则返回true ;否则返回false 。两个Bindings 对象若其属性名称、内容类型和源位置匹配,则被视为相等。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.