33class QQmlPropertyToPropertyBinding
36 static Q_QML_EXPORT QQmlAnyBinding create(
37 QQmlEngine *engine,
const QQmlProperty &source,
const QQmlProperty &target);
40 friend class QQmlPropertyToUnbindablePropertyBinding;
41 friend class QQmlUnbindableToUnbindablePropertyBinding;
42 friend class QQmlBindableToUnbindablePropertyBinding;
43 friend class QQmlPropertyToBindablePropertyBinding;
44 friend class QQmlUnbindableToBindablePropertyBinding;
45 friend class QQmlBindableToBindablePropertyBinding;
47 QQmlPropertyToPropertyBinding(
48 QQmlEngine *engine, QObject *sourceObject, QQmlPropertyIndex sourcePropertyIndex);
50 template<
typename Capture>
51 QVariant readSourceValue(Capture &&capture)
const
53 const QMetaObject *sourceMetaObject = sourceObject->metaObject();
54 const QMetaProperty property
55 = sourceMetaObject->property(sourcePropertyIndex.coreIndex());
56 if (!property.isConstant())
57 capture(sourceMetaObject, property);
61 const int valueTypeIndex = sourcePropertyIndex.valueTypeIndex();
62 if (valueTypeIndex == -1) {
63 value = property.read(sourceObject);
65 QQmlGadgetPtrWrapper *wrapper
66 = QQmlEnginePrivate::get(engine)->valueTypeInstance(property.metaType());
67 wrapper->read(sourceObject, sourcePropertyIndex.coreIndex());
68 value = wrapper->readOnGadget(wrapper->property(valueTypeIndex));
74 void doConnectNotify(QQmlNotifierEndpoint *endpoint,
const QMetaProperty &property)
76 const int notifyIndex = QMetaObjectPrivate::signalIndex(property.notifySignal());
79 if (notifyIndex == -1)
82 if (endpoint->isConnected(sourceObject, notifyIndex))
83 endpoint->cancelNotify();
85 endpoint->connect(sourceObject, notifyIndex, engine,
true);
88 QQmlEngine *engine =
nullptr;
89 QObject *sourceObject =
nullptr;
90 QQmlPropertyIndex sourcePropertyIndex;
97 void setEnabled(
bool e, QQmlPropertyData::WriteFlags flags)
final;
102 QQmlEngine *engine, QObject *sourceObject, QQmlPropertyIndex sourcePropertyIndex,
103 QObject *targetObject,
int targetPropertyIndex);
106 const QMetaObject *sourceMetaObject,
const QMetaProperty &sourceProperty) = 0;
145 QQmlEngine *engine, QObject *sourceObject, QQmlPropertyIndex sourcePropertyIndex,
146 QObject *targetObject,
int targetPropertyIndex);
148 static bool update(QMetaType metaType, QUntypedPropertyData *dataPtr,
void *f);
152 QQmlPropertyToPropertyBinding m_binding;
153 QPointer<QObject> m_targetObject;
154 QQmlPropertyIndex m_targetPropertyIndex;