6#include <private/qqmlengine_p.h>
7#include <private/qqmlcontext_p.h>
8#include <private/qqmlmetaobject_p.h>
9#include <private/qqmltypedata_p.h>
10#include <private/qqmlvaluetypewrapper_p.h>
12#include <private/qjsvalue_p.h>
13#include <private/qv4functionobject_p.h>
14#include <private/qv4objectproto_p.h>
15#include <private/qv4qobjectwrapper_p.h>
16#include <private/qv4identifiertable_p.h>
17#include <private/qv4lookup_p.h>
44 n.typeNamespace =
type;
45 n.typeNamespace->addref();
46 n.importNamespace =
import;
58 n.typeNamespace->release();
90 return d()->type().isSingleton();
99 if (
type.isSingleton()) {
105 if (metaObjectCandidate ==
type.baseMetaObject()) {
109 return object->metaObject();
116 return metaObjectCandidate;
129 if (
type.isSingleton())
151 if (!isSingleton()) {
153 d()->
object,
type.attachedPropertiesFunction(e)));
156 if (
type.isQJSValueSingleton())
172 return w.asReturnedValue();
187 return w.asReturnedValue();
220 if (
type.isValid()) {
223 if (
type.isSingleton()) {
226 if (
type.isQObjectSingleton() ||
type.isCompositeSingleton()) {
229 const bool includeEnums
231 if (includeEnums &&
name->startsWithUpper()) {
240 enumWrapper->d()->typePrivate =
type.priv();
242 enumWrapper->d()->scopeEnumIndex =
value;
243 return enumWrapper.asReturnedValue();
257 }
else if (
type.isQJSValueSingleton()) {
259 if (!scriptSingleton.isUndefined()) {
271 if (
name->startsWithUpper()) {
280 enumWrapper->d()->typePrivate =
type.priv();
282 enumWrapper->d()->scopeEnumIndex =
value;
283 return enumWrapper.asReturnedValue();
288 }
else if (
w->d()->object) {
308 if (
r.type.isValid()) {
309 return create(scope.
engine,
object,
r.type,
w->d()->typeNameMode());
310 }
else if (
r.scriptIndex != -1) {
312 return scripts->
get(
r.scriptIndex);
313 }
else if (
r.importNamespace) {
352 if (
type.isValid() && !
type.isSingleton() &&
w->d()->object) {
361 }
else if (
type.isSingleton()) {
363 if (
type.isQObjectSingleton() ||
type.isCompositeSingleton()) {
371 if (!scriptSingleton.isUndefined()) {
406 return qmlTypeWrapperA->
toVariant() == qmlTypeWrapperB->toVariant();
408 return qmlTypeWrapperA->toVariant().
value<
QObject*>() == qobjectWrapper->object();
417 const QObject *wrapperObject = objectWrapper->object();
419 return engine->throwTypeError();
421 const QMetaType myTypeId = typeWrapper->d()->type().typeId();
423 if (!myTypeId.isValid()) {
429 if (!theirDData->compilationUnit)
433 QQmlRefPointer<QQmlTypeData> td = qenginepriv->typeLoader.getType(typeWrapper->d()->type().sourceUrl());
440 if (myQmlType.isNull())
444 const QMetaObject *theirType = wrapperObject->metaObject();
458 if (
type.isValueType()) {
461 type.metaObjectForValueType()));
484 Scoped<QQmlTypeWrapper>
w(scope,
static_cast<const QQmlTypeWrapper *
>(This));
487 if (
type.isValid()) {
489 if (
type.isSingleton()) {
491 if (
type.isQObjectSingleton() ||
type.isCompositeSingleton()) {
493 const bool includeEnums
495 if (!includeEnums || !
name->startsWithUpper()) {
497 if (ddata && ddata->propertyCache) {
502 QV4::Heap::QObjectMethod *
method =
nullptr;
508 lookup, ddata,
property, val->objectValue(), This);
524 if (
name->startsWithUpper()) {
537 Scoped<QQmlScopedEnumWrapper> enumWrapper(
539 enumWrapper->d()->typePrivate =
type.priv();
541 enumWrapper->d()->scopeEnumIndex =
value;
545 static_cast<Heap::Object*
>(enumWrapper->heapObject()));
547 return enumWrapper.asReturnedValue();
566 if (
QObject *
object = typeWrapper->object()) {
596 Heap::Object *
o =
static_cast<Heap::Object *
>(
object.heapObject());
608 return revertLookup();
614 return revertLookup();
616 if (!
type.isQObjectSingleton() && !
type.isCompositeSingleton())
617 return revertLookup();
643 return revertLookup();
647 return revertLookup();
649 if (!
type.isQObjectSingleton() && !
type.isCompositeSingleton())
650 return revertLookup();
665 auto *
o =
static_cast<Heap::Object *
>(
base.heapObject());
680 auto *
o =
static_cast<Heap::Object *
>(
base.heapObject());
688 return enumWrapper.asReturnedValue();
694 typePrivate =
nullptr;
715 int index = resource->d()->scopeEnumIndex;
static QV4::ReturnedValue asReturnedValue(const QJSValue *jsval)
The QJSValue class acts as a container for Qt/JavaScript data types.
static QQmlData * get(QObjectPrivate *priv, bool create)
static QQmlEnginePrivate * get(QQmlEngine *e)
T singletonInstance(const QQmlType &type)
The QQmlEngine class provides an environment for instantiating QML components.
T singletonInstance(int qmlTypeId)
\qmlproperty string Qt::uiLanguage
static QQmlTypeLoader * get(Engine *engine)
const QMetaObject * metaObject() const
static void refHandle(const QQmlTypePrivate *priv)
static void derefHandle(const QQmlTypePrivate *priv)
\macro QT_RESTRICTED_CAST_FROM_ASCII
ObjectType::Data * allocate(Args &&... args)
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
Combined button and popup list for selecting options.
void setupQObjectMethodLookup(Lookup *lookup, const QQmlData *ddata, const QQmlPropertyData *propertyData, const Object *self, QObjectMethod *method)
void setupQObjectLookup(Lookup *lookup, const QQmlData *ddata, const QQmlPropertyData *propertyData)
Scoped< String > ScopedString
bool qualifiesForMethodLookup(const QQmlPropertyData *propertyData)
DBusConnection const char DBusError * error
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char * method
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLboolean GLboolean GLboolean b
GLfloat GLfloat GLfloat w
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
QQmlEngine * qmlEngine(const QObject *obj)
QQmlContext * qmlContext(const QObject *obj)
QObject * qmlAttachedPropertiesObject(QObject *object, QQmlAttachedPropertiesFunc func, bool create)
static int enumForSingleton(QV4::ExecutionEngine *v4, String *name, const QQmlType &type, bool *ok)
static ReturnedValue instanceOfQObject(const QV4::QQmlTypeWrapper *typeWrapper, const QObjectWrapper *objectWrapper)
QLatin1StringView QLatin1String
#define DEFINE_OBJECT_VTABLE(classname)
\inmodule QtCore \reentrant
static constexpr ReturnedValue undefined()
IdentifierTable * identifierTable
MemoryManager * memoryManager
CppStackFrame * currentStackFrame
QQmlRefPointer< QQmlContextData > callingQmlContext() const
ReturnedValue throwError(const Value &value)
QQmlEngine * qmlEngine() const
WriteBarrier::HeapObjectWrapper< CompilationUnitRuntimeData, 1 > compilationUnit
struct QV4::Heap::QQmlTypeWrapper::@673::@676 n
void init(TypeNameMode m, QObject *o, const QQmlTypePrivate *type)
const QQmlImportRef * importNamespace
QQmlTypeNameCache::Result queryNamespace(const QV4::String *name, QQmlEnginePrivate *enginePrivate) const
QV4QPointer< QObject > object
PropertyKey asPropertyKey(const Heap::String *str)
struct QV4::Lookup::@584::@607 qmlEnumValueLookup
ReturnedValue(* getter)(Lookup *l, ExecutionEngine *engine, const Value &object)
struct QV4::Lookup::@584::@598 qobjectLookup
static ReturnedValue getterGeneric(Lookup *l, ExecutionEngine *engine, const Value &object)
struct QV4::Lookup::@584::@599 qobjectMethodLookup
struct QV4::Lookup::@584::@608 qmlScopedEnumWrapperLookup
Heap::InternalClass * internalClass() const
ExecutionEngine * engine() const
bool hasProperty(PropertyKey id) const
ReturnedValue get(StringOrSymbol *name, bool *hasProperty=nullptr, const Value *receiver=nullptr) const
static bool setQmlProperty(ExecutionEngine *engine, const QQmlRefPointer< QQmlContextData > &qmlContext, QObject *object, String *name, Flags flags, const Value &value)
ReturnedValue getQmlProperty(const QQmlRefPointer< QQmlContextData > &qmlContext, String *name, Flags flags, bool *hasProperty=nullptr) const
static ReturnedValue lookupPropertyGetterImpl(Lookup *l, ExecutionEngine *engine, const Value &object, Flags flags, ReversalFunctor revert)
static ReturnedValue wrap(ExecutionEngine *engine, QObject *object)
static ReturnedValue lookupMethodGetterImpl(Lookup *l, ExecutionEngine *engine, const Value &object, Flags flags, ReversalFunctor revert)
static ReturnedValue lookupScopedEnum(Lookup *l, ExecutionEngine *engine, const Value &base)
static ReturnedValue lookupSingletonMethod(Lookup *l, ExecutionEngine *engine, const Value &base)
static ReturnedValue create(ExecutionEngine *, QObject *, const QQmlType &, Heap::QQmlTypeWrapper::TypeNameMode=Heap::QQmlTypeWrapper::IncludeEnums)
V4_NEEDS_DESTROY bool isSingleton() const
QObject * singletonObject() const
const QMetaObject * metaObject() const
QVariant toVariant() const
static ReturnedValue lookupEnumValue(Lookup *l, ExecutionEngine *engine, const Value &base)
static ReturnedValue lookupSingletonProperty(Lookup *l, ExecutionEngine *engine, const Value &base)
bool hasException() const
QV4_NEARLY_ALWAYS_INLINE constexpr quint32 value() const
static constexpr VTable::OwnPropertyKeys virtualOwnPropertyKeys
static constexpr VTable::GetOwnProperty virtualGetOwnProperty
static constexpr VTable::Get virtualGet
static constexpr VTable::Metacall virtualMetacall
static constexpr VTable::InstanceOf virtualInstanceOf
static constexpr VTable::Put virtualPut
static constexpr VTable::IsEqualTo virtualIsEqualTo
static constexpr VTable::ResolveLookupGetter virtualResolveLookupGetter
static constexpr VTable::ResolveLookupSetter virtualResolveLookupSetter
static constexpr Value fromInt32(int i)
static constexpr Value fromReturnedValue(ReturnedValue val)