35class QQmlPropertyToPropertyBinding
38 static Q_QML_EXPORT QQmlAnyBinding create(
39 QQmlEngine *engine,
const QQmlProperty &source,
const QQmlProperty &target);
42 friend class QQmlPropertyToUnbindablePropertyBinding;
43 friend class QQmlUnbindableToUnbindablePropertyBinding;
44 friend class QQmlBindableToUnbindablePropertyBinding;
45 friend class QQmlPropertyToBindablePropertyBinding;
46 friend class QQmlUnbindableToBindablePropertyBinding;
47 friend class QQmlBindableToBindablePropertyBinding;
49 QQmlPropertyToPropertyBinding(QQmlEngine *engine,
const QQmlProperty &source);
51 template<
typename Capture>
52 QVariant readSourceValue(Capture &&capture)
const
54 const QMetaObject *sourceMetaObject = sourceObject->metaObject();
55 const QMetaProperty property
56 = sourceMetaObject->property(sourcePropertyIndex.coreIndex());
57 if (!property.isConstant())
58 capture(sourceMetaObject, property);
62 const int valueTypeIndex = sourcePropertyIndex.valueTypeIndex();
63 if (valueTypeIndex == -1) {
64 value = property.read(sourceObject);
66 QQmlGadgetPtrWrapper *wrapper
67 = QQmlEnginePrivate::get(engine)->valueTypeInstance(property.metaType());
68 wrapper->read(sourceObject, sourcePropertyIndex.coreIndex());
69 value = wrapper->readOnGadget(wrapper->property(valueTypeIndex));
75 void doConnectNotify(QQmlNotifierEndpoint *endpoint,
const QMetaProperty &property)
77 const int notifyIndex = QMetaObjectPrivate::signalIndex(property.notifySignal());
80 if (notifyIndex == -1)
83 if (endpoint->isConnected(sourceObject, notifyIndex))
84 endpoint->cancelNotify();
86 endpoint->connect(sourceObject, notifyIndex, engine,
true);
89 QQmlEngine *engine =
nullptr;
90 QObject *sourceObject =
nullptr;
91 QQmlPropertyIndex sourcePropertyIndex;