6#include <private/qqmlanybinding_p.h>
7#include <private/qqmlengine_p.h>
8#include <private/qqmlvmemetaobject_p.h>
9#include <private/qv4alloca_p.h>
11#include <QtQml/qqmlinfo.h>
16
17
18
19
20
21
22
23
24
25
27QQmlAnyBinding QQmlPropertyToPropertyBinding::create(
28 QQmlEngine *engine,
const QQmlProperty &source,
const QQmlProperty &target)
30 QQmlAnyBinding result;
31 if (target.isBindable() && !QQmlPropertyPrivate::get(target)->isValueType()) {
32 if (source.isBindable()) {
33 result = QUntypedPropertyBinding(
new QQmlBindableToBindablePropertyBinding(
34 engine, source, target));
38 result = QUntypedPropertyBinding(
new QQmlUnbindableToBindablePropertyBinding(
39 engine, source, target));
43 if (source.isBindable()) {
44 result =
new QQmlBindableToUnbindablePropertyBinding(engine, source, target);
48 result =
new QQmlUnbindableToUnbindablePropertyBinding(engine, source, target);
52QQmlPropertyToPropertyBinding::QQmlPropertyToPropertyBinding(
53 QQmlEngine *engine,
const QQmlProperty &source)
55 , sourceObject(source.object())
56 , sourcePropertyIndex(QQmlPropertyPrivate::get(source)->encodedIndex())
61 QQmlEngine *engine,
const QQmlProperty &source,
const QQmlProperty &target)
69 return PropertyToPropertyBinding;
73 bool e, QQmlPropertyData::WriteFlags flags)
75 const bool wasEnabled = enabledFlag();
77 updateCanUseAccessor();
88 QObject *target = targetObject();
89 if (QQmlData::wasDeleted(target))
92 const QQmlPropertyData *d =
nullptr;
94 getPropertyData(&d, &vtd);
98 if (Q_UNLIKELY(updatingFlag()))
101 setUpdatingFlag(
true);
103 if (canUseAccessor())
104 flags.setFlag(QQmlPropertyData::BypassInterceptor);
106 QVariant value = m_binding.readSourceValue(
107 [&](
const QMetaObject *sourceMetaObject,
const QMetaProperty &property) {
108 captureProperty(sourceMetaObject, property);
111 QQmlPropertyPrivate::writeValueProperty(target, *d, vtd, value, {}, flags);
112 setUpdatingFlag(
false);
116 QQmlEngine *engine,
const QQmlProperty &source,
const QQmlProperty &target)
123 QQmlEngine *engine,
const QQmlProperty &source,
const QQmlProperty &target)
130 QPropertyObserver *observer, QUntypedPropertyData *)
133 ->QQmlPropertyToUnbindablePropertyBinding::update();
137 const QMetaObject *sourceMetaObject,
const QMetaProperty &sourceProperty)
139 Q_UNUSED(sourceMetaObject);
140 m_binding.doConnectNotify(
this, sourceProperty);
144 const QMetaObject *sourceMetaObject,
const QMetaProperty &sourceProperty)
146 Q_UNUSED(sourceProperty);
152 QUntypedBindable bindable;
153 void *argv[] = { &bindable };
154 sourceMetaObject->metacall(
155 m_binding.sourceObject, QMetaObject::BindableProperty,
156 m_binding.sourcePropertyIndex.coreIndex(), argv);
157 bindable.observe(
this);
158 m_isObserving =
true;
167 [](
void *,
void *){},
173 QQmlEngine *engine,
const QQmlProperty &source,
const QQmlProperty &target,
174 const QtPrivate::BindingFunctionVTable *vtable)
182 QQmlEngine *engine,
const QQmlProperty &source,
const QQmlProperty &target)
193 PendingBindingObserverList bindingObservers;
194 evaluateRecursive(bindingObservers);
196 if (
const QPropertyBindingError error = bindingError();
197 Q_UNLIKELY(error.type() == QPropertyBindingError::BindingLoop)) {
201 notifyNonRecursive(bindingObservers);
205 QQmlEngine *engine,
const QQmlProperty &source,
const QQmlProperty &target)
QQmlBindableToBindablePropertyBinding(QQmlEngine *engine, const QQmlProperty &source, const QQmlProperty &target)
void captureProperty(const QMetaObject *sourceMetaObject, const QMetaProperty &sourceProperty) final
QQmlBindableToUnbindablePropertyBinding(QQmlEngine *engine, const QQmlProperty &source, const QQmlProperty &target)
QQmlPropertyToBindablePropertyBinding(QQmlEngine *engine, const QQmlProperty &source, const QQmlProperty &target, const QtPrivate::BindingFunctionVTable *vtable)
void setEnabled(bool e, QQmlPropertyData::WriteFlags flags) final
QQmlPropertyToUnbindablePropertyBinding(QQmlEngine *engine, const QQmlProperty &source, const QQmlProperty &target)
void update(QQmlPropertyData::WriteFlags flags=QQmlPropertyData::DontRemoveBinding)
QQmlUnbindableToBindablePropertyBinding(QQmlEngine *engine, const QQmlProperty &source, const QQmlProperty &target)
QQmlUnbindableToUnbindablePropertyBinding(QQmlEngine *engine, const QQmlProperty &source, const QQmlProperty &target)
void captureProperty(const QMetaObject *sourceMetaObject, const QMetaProperty &sourceProperty) final
constexpr BindingFunctionVTable bindingFunctionVTableForQQmlPropertyToBindablePropertyBinding
void QQmlUnbindableToBindableGuard_callback(QQmlNotifierEndpoint *e, void **)
void QQmlUnbindableToUnbindableGuard_callback(QQmlNotifierEndpoint *e, void **)