103 QQmlInterceptorMetaObject(QObject *obj,
const QQmlPropertyCache::ConstPtr &cache);
104 ~QQmlInterceptorMetaObject() override;
106 void registerInterceptor(QQmlPropertyIndex index, QQmlPropertyValueInterceptor *interceptor);
108 static QQmlInterceptorMetaObject *get(QObject *obj);
110#if QT_VERSION >= QT_VERSION_CHECK(7
, 0
, 0
)
111 const QMetaObject *toDynamicMetaObject(QObject *o)
const override;
113 QMetaObject *toDynamicMetaObject(QObject *o) override;
117 QQmlPropertyCache::ConstPtr propertyCache()
const {
return cache; }
119 bool intercepts(QQmlPropertyIndex propertyIndex)
const
121 for (
auto it = interceptors; it; it = it->m_next) {
122 if (it->m_propertyIndex == propertyIndex)
125 if (
auto parentInterceptor = ((parent.isT1() && parent.flag()) ?
static_cast<QQmlInterceptorMetaObject *>(parent.asT1()) :
nullptr))
126 return parentInterceptor->intercepts(propertyIndex);
130 void invalidate() { metaObject.setTag(MetaObjectInvalid); }
132 QObject *object =
nullptr;
133 QQmlPropertyCache::ConstPtr cache;
136 int metaCall(QObject *o, QMetaObject::Call c,
int id,
void **a) override;
137 bool intercept(QMetaObject::Call c,
int id,
void **a)
143 case QMetaObject::WriteProperty:
144 if (*
reinterpret_cast<
int*>(a[3]) & QQmlPropertyData::BypassInterceptor)
147 case QMetaObject::BindableProperty:
153 return doIntercept(c, id, a);
156 QBiPointer<QDynamicMetaObjectData,
const QMetaObject> parent;
158 enum MetaObjectValidity { MetaObjectValid, MetaObjectInvalid };
159 QTaggedPointer<
const QMetaObject, MetaObjectValidity> metaObject;
162 bool doIntercept(QMetaObject::Call c,
int id,
void **a);
163 QQmlPropertyValueInterceptor *interceptors =
nullptr;
182 QQmlVMEMetaObject(QV4::ExecutionEngine *engine, QObject *obj,
183 const QQmlPropertyCache::ConstPtr &cache,
184 const QQmlRefPointer<QV4::ExecutableCompilationUnit> &qmlCompilationUnit,
186 ~QQmlVMEMetaObject() override;
188 bool aliasTarget(
int index, QObject **target,
int *coreIndex,
int *valueTypeIndex)
const;
189 QV4::ReturnedValue vmeMethod(
int index)
const;
190 void setVmeMethod(
int index,
const QV4::Value &function);
191 QV4::ReturnedValue vmeProperty(
int index)
const;
192 void setVMEProperty(
int index,
const QV4::Value &v);
194 void connectAliasSignal(
int index,
bool indexInSignalRange);
196 static inline QQmlVMEMetaObject *get(QObject *o);
197 static QQmlVMEMetaObject *getForProperty(QObject *o,
int coreIndex);
198 static QQmlVMEMetaObject *getForMethod(QObject *o,
int coreIndex);
199 static QQmlVMEMetaObject *getForSignal(QObject *o,
int coreIndex);
201 static void list_append(QQmlListProperty<QObject> *prop, QObject *o);
202 static void list_clear(QQmlListProperty<QObject> *prop);
203 static void list_append_nosignal(QQmlListProperty<QObject> *prop, QObject *o);
204 static void list_clear_nosignal(QQmlListProperty<QObject> *prop);
207 int metaCall(QObject *o, QMetaObject::Call _c,
int _id,
void **_a) override;
208 bool getListProperty(
int id, QQmlListProperty<QObject> *target);
211 QV4::ExecutionEngine *engine;
212 QQmlGuardedContextData ctxt;
214 inline int propOffset()
const;
215 inline int propCount()
const;
216 inline int aliasOffset()
const;
217 inline int aliasCount()
const;
218 inline int signalOffset()
const;
219 inline int signalCount()
const;
220 inline int methodOffset()
const;
221 inline int methodCount()
const;
223 QQmlVMEMetaObjectEndpoint *aliasEndpoints;
225 QV4::WeakValue propertyAndMethodStorage;
226 QV4::MemberData *propertyAndMethodStorageAsMemberData()
const;
228 int readPropertyAsInt(
int id)
const;
229 bool readPropertyAsBool(
int id)
const;
230 double readPropertyAsDouble(
int id)
const;
231 QString readPropertyAsString(
int id)
const;
232 QSizeF readPropertyAsSizeF(
int id)
const;
233 QPointF readPropertyAsPointF(
int id)
const;
234 QUrl readPropertyAsUrl(
int id)
const;
235 QDate readPropertyAsDate(
int id)
const;
236 QTime readPropertyAsTime(
int id)
const;
237 QDateTime readPropertyAsDateTime(
int id)
const;
239#if QT_CONFIG(regularexpression)
240 QRegularExpression readPropertyAsRegularExpression(
int id)
const;
243 QRectF readPropertyAsRectF(
int id)
const;
244 QObject *readPropertyAsQObject(
int id)
const;
245 void initPropertyAsList(
int id)
const;
247 void writeProperty(
int id,
int v);
248 void writeProperty(
int id,
bool v);
249 void writeProperty(
int id,
double v);
250 void writeProperty(
int id,
const QString& v);
252 template<
typename VariantCompatible>
253 void writeProperty(
int id,
const VariantCompatible &v)
255 QV4::MemberData *md = propertyAndMethodStorageAsMemberData();
257 QV4::Scope scope(engine);
258 QV4::Scoped<QV4::MemberData>(scope, md)->set(
259 engine, id, engine->newVariantObject(
260 QMetaType::fromType<VariantCompatible>(), &v));
264 void writeProperty(
int id, QObject *v);
266 void ensureQObjectWrapper();
268 void mark(QV4::MarkStack *markStack);
270 void connectAlias(
const QV4::CompiledData::Object *compiledObject,
int aliasId);
272 QV4::ReturnedValue method(
int)
const;
274 QV4::ReturnedValue readVarProperty(
int)
const;
275 void writeVarProperty(
int,
const QV4::Value &);
276 QVariant readPropertyAsVariant(
int)
const;
278 inline QQmlVMEMetaObject *parentVMEMetaObject()
const;
280 void activate(QObject *,
int,
void **);
282 QList<QQmlVMEVariantQObjectPtr *> varObjectGuards;
284 QQmlVMEVariantQObjectPtr *getQObjectGuardForProperty(
int)
const;
287 friend class QQmlVMEMetaObjectEndpoint;
291 QQmlRefPointer<QV4::ExecutableCompilationUnit> compilationUnit;
292 int qmlObjectId = -1;
295 const QV4::CompiledData::Object *findCompiledObject()
const {
297 if (!compilationUnit || !compilationUnit->engine)
300 Q_ASSERT(qmlObjectId >= 0 && qmlObjectId < compilationUnit->objectCount());
301 return compilationUnit->objectAt(qmlObjectId);
304 void writeKnownVarProperty(
int id,
const QVariant &value);