QQmlSA::Binding Class

class QQmlSA::Binding

代表特定类型的单一 QML 属性绑定。更多

头文件: #include <Binding>
CMake: find_package(Qt6 REQUIRED COMPONENTS QmlCompiler)
target_link_libraries(mytarget PRIVATE Qt6::QmlCompiler)
状态: 技术预览技术预览

公共类型

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 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(const QQmlSA::Binding &other)

创建other 的副本。

[noexcept] Binding::Binding(QQmlSA::Binding &&other)

移动-构建Binding 实例。

[noexcept] Binding::~Binding()

破坏装订。

QQmlSA::Element Binding::attachedType() const

如果此绑定的内容类型是AttachedProperty ,则返回附加类型,否则返回无效元素。

QQmlSA::Element Binding::bindingScope() const

返回定义绑定的元素作用域。

QQmlSA::BindingType Binding::bindingType() const

返回此绑定的类型。

QQmlSA::Element Binding::groupType() const

如果是组属性,则返回此绑定的属性类型,否则返回无效元素。

bool Binding::hasObject() const

如果此绑定有对象,则返回true ,否则返回false

bool Binding::hasUndefinedScriptValue() const

返回此绑定是否具有未定义的脚本值类型,就像分配给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

如果此绑定的内容类型是对象,则返回相关对象的类型,否则返回无效元素。

QString Binding::propertyName() const

返回与此绑定绑定的属性名称。

QQmlSA::ScriptBindingKind Binding::scriptKind() const

如果此绑定的内容类型为脚本,则返回相关脚本的类型,否则返回无效。

QQmlSA::SourceLocation Binding::sourceLocation() const

返回 QML 代码中定义此绑定的位置。

QString Binding::stringValue() const

如果绑定的内容类型是StringLiteral ,则返回相关的字符串字面量,否则返回空字符串。

[noexcept] QQmlSA::Binding &Binding::operator=(QQmlSA::Binding &&other)

移动-将other 指定给此绑定实例。

QQmlSA::Binding &Binding::operator=(const QQmlSA::Binding &other)

为该绑定实例指定other

相关非成员

bool operator!=(const QQmlSA::Binding &lhs, const QQmlSA::Binding &rhs)

如果lhsrhs 不相等,则返回true ,否则返回false 。如果两个Bindings 的属性名称、内容类型和来源位置相匹配,则视为相等。

bool operator==(const QQmlSA::Binding &lhs, const QQmlSA::Binding &rhs)

如果lhsrhs 相等,则返回true ,否则返回false 。如果两个Bindings 的属性名称、内容类型和来源位置匹配,则视为相等。

© 2025 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.