- Qt 6.10
- Qt QML Compiler
- C++ Classes
- QtQmlCompiler (Technical Preview)
- Binding
- Qt 6.10.2 Reference Documentation

# QQmlSA::Binding Class

class QQmlSA::Binding

Represents a single QML property binding for a specific type. More...

Header: | `#include <Binding>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS QmlCompiler)` `target_link_libraries(mytarget PRIVATE Qt6::QmlCompiler)`
Status: | Technical Preview

- List of all members, including inherited members
- Deprecated members

## Public Types

class | Bindings

## Public Functions

| 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)

## Static Public Members

bool | isLiteralBinding(QQmlSA::BindingType bindingType)

## Related Non-Members

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

## Detailed Description

## Member Function Documentation

### Binding::Binding()

Constructs a new Binding object.

### Binding::Binding(const QQmlSA::Binding &other)

Creates a copy of other.

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

Move-constructs a `Binding` instance.

### `[noexcept]` Binding::~Binding()

Destroys the binding.

### QQmlSA::Element Binding::attachedType() const

Returns the attached type if the content type of this binding is AttachedProperty, otherwise returns an invalid Element.

### QQmlSA::Element Binding::bindingScope() const

Returns the Element scope in which the binding is defined.

### QQmlSA::BindingType Binding::bindingType() const

Returns the type of this binding.

### QQmlSA::Element Binding::groupType() const

Returns the type of the property of this binding if it is a group property, otherwise returns an invalid Element.

### bool Binding::hasFunctionScriptValue() const

Returns whether this binding has script value type function like when it is assigned a (lambda) method, an arrow function or a statement block. If the content type of this binding is not QQmlSA::BindingType::Script, returns `false`.

### bool Binding::hasObject() const

Returns `true` if this binding has an objects, otherwise returns `false`.

### bool Binding::hasUndefinedScriptValue() const

Returns whether this binding has script value type undefined like when it is assigned `undefined`. If the content type of this binding is not QQmlSA::BindingType::Script, returns `false`.

### bool Binding::isAttached() const

Returns `true` if this type is attached to another one, `false` otherwise.

### `[static]` bool Binding::isLiteralBinding(QQmlSA::BindingType bindingType)

Returns `true` if bindingType is a literal type, and `false` otherwise.

### double Binding::numberValue() const

Returns the associated number if the content type of this binding is NumberLiteral, otherwise returns 0.

### QQmlSA::Element Binding::objectType() const

Returns the type of the associated object if the content type of this binding is Object, otherwise returns an invalid Element.

### QString Binding::propertyName() const

Returns the name of the property bound with this binding.

### QQmlSA::ScriptBindingKind Binding::scriptKind() const

Returns the kind of the associated script if the content type of this binding is Script, otherwise returns Invalid.

### QQmlSA::SourceLocation Binding::sourceLocation() const

Returns the location in the QML code where this binding is defined.

### QString Binding::stringValue() const

Returns the associated string literal if the content type of this binding is StringLiteral, otherwise returns an empty string.

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

Move-assigns other to this Binding instance.

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

Assigns other to this Binding instance.

## Related Non-Members

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

Returns `true` if lhs and rhs are not equal, and `false` otherwise. Two `Bindings` are considered equal if their property name, content type, and source location match.

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

Returns `true` if lhs and rhs are equal, and `false` otherwise. Two `Bindings` are considered equal if their property name, content type, and source location match.