19#include <QtQml/qjsprimitivevalue.h>
20#include <QtQml/qjsvalue.h>
21#include <QtQml/qqmllist.h>
22#include <QtQml/qqmlparserstatus.h>
23#include <QtQml/qqmlpropertyvaluesource.h>
24#include <QtQml/qtqmlglobal.h>
26#include <QtCore/qdatetime.h>
27#include <QtCore/qdebug.h>
28#include <QtCore/qglobal.h>
29#include <QtCore/qmetasequence.h>
30#include <QtCore/qmetaobject.h>
31#include <QtCore/qpointer.h>
32#include <QtCore/qurl.h>
33#include <QtCore/qvariant.h>
34#include <QtCore/qversionnumber.h>
42class QQmlPropertyValueInterceptor;
44class QQmlFinalizerHook;
53struct ExecutionEngine;
55class ExecutableCompilationUnit;
65using QQmlAttachedPropertiesFunc = QQmlPrivate::QQmlAttachedPropertiesFunc<QObject>;
67inline size_t qHash(QQmlAttachedPropertiesFunc func, size_t seed = 0)
69 return qHash(quintptr(func), seed);
72template <
typename TYPE>
84class QQmlCustomParser;
101 class QQmlElement final :
public T
108 QQmlPrivate::qdeclarativeelement_destructor(
this);
119 static void operator
delete(
void *,
void *) {
136 template<
typename T,
typename WrapperT =
T,
typename =
std::
void_t<>>
139 static constexpr bool value =
false;
155 template<
typename Ret,
typename Class>
161 template<
typename T,
typename Marker>
169 static auto test(
int) -> std::enable_if_t<
170 QmlTypeHasMarker<U,
decltype(&U::qt_qmlMarker_uncreatable)>::value
171 &&
bool(U::QmlIsUncreatable::yes),
175 static auto test(...) -> std::false_type;
178 static constexpr bool Value =
decltype(test<T>(0))::value;
181 template<
typename T,
typename WrapperT>
184 if constexpr (!std::is_base_of<QObject, T>::value)
188 if constexpr (!std::is_same_v<T, WrapperT> && HasSingletonFactory<T, WrapperT>::value)
190 if constexpr (
std::is_default_constructible<T>::value)
192 if constexpr (HasSingletonFactory<T>::value)
199 void createInto(
void *memory,
void *) {
new (memory) QQmlElement<T>; }
209 return T::create(q, j);
211 return WrapperT::create(q, j);
224 template<
typename T,
typename WrapperT = T,
228 template<
typename T,
typename WrapperT>
238 template<
typename T,
typename WrapperT>
245 template<
typename T,
typename WrapperT>
254 template<
typename T,
typename WrapperT>
263 template<
typename T,
typename WrapperT>
300 template<
typename F,
typename Result =
void>
303 static constexpr const Result (*create)(
const QJSValue &) =
nullptr;
315 template<
typename T,
typename F,
321 template<
typename T,
typename F>
327 template<
typename T,
typename F,
bool HasCtor>
332 return F::create(params);
336 template<
typename T,
typename F>
341 return QVariant::fromValue(T(params));
345 template<
class From,
class To,
int N>
348 static inline int cast() {
return -1; }
351 template<
class From,
class To>
354 static inline int cast() {
return int(
reinterpret_cast<quintptr>(
static_cast<To *>(
reinterpret_cast<From *>(0x10000000)))) - 0x10000000; }
357 template<
class From,
class To>
374 template<
class T,
class A>
449 return QQmlAttachedPropertiesFunc<QObject>(QmlAttached<T>::attachedPropertiesFunc());
454 return QmlAttached<T>::staticMetaObject();
549 QQmlCustomParser *(*customParserFactory)();
702#if QT_QML_REMOVED_SINCE(6
, 9
)
744#if QT_QML_REMOVED_SINCE(6
, 9
)
758#if QT_QML_REMOVED_SINCE(6
, 9
)
776#if QT_QML_REMOVED_SINCE(6
, 9
)
793#if QT_QML_REMOVED_SINCE(6
, 9
)
800#if QT_QML_REMOVED_SINCE(6
, 9
)
805#if QT_QML_REMOVED_SINCE(6
, 6
)
814#if QT_QML_REMOVED_SINCE(6
, 9
)
821#if QT_QML_REMOVED_SINCE(6
, 9
)
847 template<
typename Value>
854 void (*
signature)(
QV4::ExecutableCompilationUnit *unit, QMetaType *argTypes);
855 void (*
functionPtr)(
const AOTCompiledContext *context,
void **argv);
858#if QT_DEPRECATED_SINCE(6
, 6
)
869 typedef const CachedQmlUnit *(*QmlUnitCacheLookupFunction)(
const QUrl &url);
892#if QT_DEPRECATED_SINCE(6
, 3
)
915 if (!metaObject || !key)
918 const int offset = metaObject->classInfoOffset();
919 const int start = (startOffset == -1)
920 ? (metaObject->classInfoCount() + offset - 1)
922 for (
int i = start; i >= offset; --i)
923 if (qstrcmp(key, metaObject->classInfo(i).name()) == 0) {
929 inline const char *
classInfo(
const QMetaObject *metaObject,
const char *key)
931 return metaObject->classInfo(indexOfOwnClassInfo(metaObject, key)).value();
935 QTypeRevision defaultValue = QTypeRevision())
937 const int index = indexOfOwnClassInfo(metaObject, key);
938 return (index == -1) ? defaultValue
939 : QTypeRevision::fromEncodedVersion(
940 QLatin1StringView(metaObject->classInfo(index).value()).toInt());
946 bool defaultValue =
false)
948 const int index = indexOfOwnClassInfo(metaObject, key);
951 return qstrcmp(metaObject->classInfo(index).value(),
"true") == 0;
966 static auto test(
int) -> std::conditional_t<
967 QmlTypeHasMarker<U,
decltype(&U::qt_qmlMarker_extended)>::value,
968 typename U::QmlExtendedType *,
973 static auto test(...) ->
void *;
986 static constexpr auto metaObjectImpl(
int) ->
987 decltype((
void)U::qmlExtendedNamespace(),
static_cast<
const QMetaObject *>(
nullptr))
989 if constexpr (QmlTypeHasMarker<U,
decltype(&U::qt_qmlMarker_extendedNamespace)>::value)
990 return U::qmlExtendedNamespace();
996 static constexpr auto metaObjectImpl(...) ->
const QMetaObject *
1010 static auto test(
int) -> std::conditional_t<
1011 QmlTypeHasMarker<U,
decltype(&U::qt_qmlMarker_foreign)>::value,
1012 typename U::QmlForeignType *,
1017 static auto test(...) -> U *;
1028 static auto test(
int) -> std::enable_if_t<
1029 QmlTypeHasMarker<U,
decltype(&U::qt_qmlMarker_anonymous)>::value
1030 &&
bool(U::QmlIsAnonymous::yes),
1035 static auto test(...) -> std::false_type;
1038 static constexpr bool Value =
decltype(test<T>(0))::value;
1046 static auto test(
int) -> std::enable_if_t<
1047 QmlTypeHasMarker<U,
decltype(&U::qt_qmlMarker_singleton)>::value
1048 &&
bool(U::QmlIsSingleton::yes),
1053 static auto test(...) -> std::false_type;
1056 static constexpr bool Value =
decltype(test<T>(0))::value;
1067 static auto test_impl(...) -> std::false_type;
1070 static constexpr bool test() {
1071 if constexpr (
decltype(test_impl<U>(0))::value) {
1072 static_assert((
std::is_same_v<
typename U::QmlSequenceValueType,
1080 static constexpr bool Value = test<T>();
1088 static auto test(
int) ->
1092 static auto test(...) -> std::false_type;
1095 static constexpr bool Value =
decltype(test<T>(0))::value;
1098 template<
class T,
typename =
std::
void_t<>>
1115 if constexpr (!
std::is_default_constructible_v<T>)
1117 else if constexpr (std::is_base_of_v<QObject, T>)
1120 return std::is_copy_constructible_v<T>;
1125 if constexpr (std::is_base_of_v<QObject, T>)
1126 return QMetaType::fromType<T*>();
1128 return QMetaType::fromType<T>();
1133 if constexpr (std::is_base_of_v<QObject, T>)
1134 return QMetaType::fromType<QQmlListProperty<T>>();
1136 return QMetaType::fromType<QList<T>>();
1141 if constexpr (std::is_base_of_v<QObject, T>)
1142 return QMetaSequence();
1144 return QMetaSequence::fromContainer<QList<T>>();
1160 static constexpr int size() {
return 0; }
1163 template<
typename T,
typename E,
typename WrapperT = T>
1165 const QMetaObject *classInfoMetaObject,
1166 QList<
int> *qmlTypeIds,
const QMetaObject *extension)
1168 static_assert(std::is_base_of_v<QObject, T>);
1173 QTypeRevision::fromMajorVersion(versionMajor),
1175 Constructors<T, WrapperT>::createSingletonInstance,
1177 StaticMetaObject<T>::staticMetaObject(),
1178 classInfoMetaObject,
1180 QmlMetaType<T>::self(),
1182 ExtendedType<E>::createParent,
1183 extension ? extension : ExtendedType<E>::staticMetaObject(),
1191 template<
typename T,
typename E>
1193 const QMetaObject *classInfoMetaObject,
1194 QList<
int> *qmlTypeIds,
const QMetaObject *extension,
1195 bool forceAnonymous =
false)
1199 QmlMetaType<T>::self(),
1200 QmlMetaType<T>::list(),
1201 QmlMetaType<T>::size(),
1202 Constructors<T>::createInto,
1204 ValueType<T, E>::create,
1207 QTypeRevision::fromMajorVersion(versionMajor),
1209 StaticMetaObject<T>::staticMetaObject(),
1210 classInfoMetaObject,
1212 attachedPropertiesFunc<T>(),
1213 attachedPropertiesMetaObject<T>(),
1215 StaticCastSelector<T, QQmlParserStatus>::cast(),
1216 StaticCastSelector<T, QQmlPropertyValueSource>::cast(),
1217 StaticCastSelector<T, QQmlPropertyValueInterceptor>::cast(),
1219 ExtendedType<E>::createParent,
1220 extension ? extension : ExtendedType<E>::staticMetaObject(),
1222 &qmlCreateCustomParser<T>,
1224 StaticCastSelector<T, QQmlFinalizerHook>::cast(),
1227 QmlMetaType<T>::sequence(),
1236 template<
typename T>
1238 const QMetaObject *classInfoMetaObject,
1239 QList<
int> *qmlTypeIds)
1244 QTypeRevision::fromMajorVersion(versionMajor),
1245 classInfoMetaObject,
1246 QMetaType::fromType<T>(),
1247 QMetaSequence::fromContainer<T>(),
1260 const QtPrivate::QMetaTypeInterface::MetaObjectFn &metaObjectFunction,
const char *name)
1306Q_DECLARE_OPAQUE_POINTER(QQmlV4FunctionPtr)
1307Q_DECLARE_OPAQUE_POINTER(QQmlV4ExecutionEnginePtr)
void operator delete(void *)
static void operator delete(void *ptr)
QTypeRevision revisionClassInfo(const QMetaObject *metaObject, const char *key, QTypeRevision defaultValue=QTypeRevision())
QObject * createParent(QObject *p)
A *(*)(QObject *) QQmlAttachedPropertiesFunc
constexpr QtPrivate::QMetaTypeInterface metaTypeForNamespace(const QtPrivate::QMetaTypeInterface::MetaObjectFn &metaObjectFunction, const char *name)
void(*)(void *, void *) CreateIntoFunction
std::is_same< T, typename QmlMarkerFunction< Marker >::ClassType > QmlTypeHasMarker
QObject * createSingletonInstance(QQmlEngine *q, QJSEngine *j)
void Q_QML_EXPORT qmlRegisterTypeAndRevisions< QQmlTypeNotAvailable, void >(const char *uri, int versionMajor, const QMetaObject *classInfoMetaObject, QList< int > *qmlTypeIds, const QMetaObject *, bool)
static int indexOfOwnClassInfo(const QMetaObject *metaObject, const char *key, int startOffset=-1)
void createInto(void *memory, void *)
void qmlRegisterSequenceAndRevisions(const char *uri, int versionMajor, const QMetaObject *classInfoMetaObject, QList< int > *qmlTypeIds)
Q_QML_EXPORT void qmlRegistrationWarning(QmlRegistrationWarning warning, QMetaType type)
@ CompositeSingletonRegistration
@ SequentialContainerRegistration
@ SequentialContainerAndRevisionsRegistration
@ QmlUnitCacheHookRegistration
@ SingletonAndRevisionsRegistration
@ TypeAndRevisionsRegistration
SingletonConstructionMode
QQmlAttachedPropertiesFunc< QObject > attachedPropertiesFunc()
@ UnconstructibleSingleton
constexpr SingletonConstructionMode singletonConstructionMode()
const QMetaObject * attachedPropertiesMetaObject()
const char * classInfo(const QMetaObject *metaObject, const char *key)
void qmlRegisterSingletonAndRevisions(const char *uri, int versionMajor, const QMetaObject *classInfoMetaObject, QList< int > *qmlTypeIds, const QMetaObject *extension)
bool boolClassInfo(const QMetaObject *metaObject, const char *key, bool defaultValue=false)
void qmlRegisterTypeAndRevisions(const char *uri, int versionMajor, const QMetaObject *classInfoMetaObject, QList< int > *qmlTypeIds, const QMetaObject *extension, bool forceAnonymous=false)
Combined button and popup list for selecting options.
DECLARE_HEAP_OBJECT(DynamicFunctionObject, FunctionObject)
DECLARE_HEAP_OBJECT(BoundFunction, JavaScriptFunctionObject)
DECLARE_HEAP_OBJECT(ConstructorFunction, ScriptFunction)
DECLARE_HEAP_OBJECT(FunctionObject, Object)
DECLARE_HEAP_OBJECT(JavaScriptFunctionObject, FunctionObject)
DECLARE_HEAP_OBJECT(MemberFunction, ArrowFunction)
DECLARE_HEAP_OBJECT(ScriptFunction, ArrowFunction)
ReturnedValue checkedResult(QV4::ExecutionEngine *v4, ReturnedValue result)
void(* IRLoaderFunction)(Document *, const QQmlPrivate::CachedQmlUnit *)
size_t qHash(QByteArrayView key, size_t seed) noexcept
QQmlCustomParser * qmlCreateCustomParser()
QV4::ExecutionEngine * QQmlV4ExecutionEnginePtr
QQmlV4Function * QQmlV4FunctionPtr
DEFINE_OBJECT_VTABLE(SharedArrayBufferCtor)
DEFINE_OBJECT_VTABLE(ArrayBufferCtor)
DEFINE_OBJECT_VTABLE(ArrayBuffer)
DEFINE_OBJECT_VTABLE(SharedArrayBuffer)
#define Q_MANAGED_TYPE(type)
#define V4_INTERNALCLASS(c)
#define RETURN_UNDEFINED()
void(* functionPtr)(const AOTCompiledContext *context, void **argv)
void(* signature)(QV4::ExecutableCompilationUnit *unit, QMetaType *argTypes)
virtual ~AOTTrackedLocalsStorage()=default
virtual void markObjects(QV4::MarkStack *markStack) const =0
const AOTCompiledFunction * aotCompiledFunctions
const QV4::CompiledData::Unit * qmlData
static constexpr CreateIntoFunction createInto
static constexpr CreateSingletonFunction createSingletonInstance
static constexpr CreateIntoFunction createInto
static constexpr CreateSingletonFunction createSingletonInstance
static constexpr CreateIntoFunction createInto
static constexpr CreateSingletonFunction createSingletonInstance
static constexpr CreateSingletonFunction createSingletonInstance
static constexpr CreateIntoFunction createInto
static constexpr CreateSingletonFunction createSingletonInstance
static constexpr CreateIntoFunction createInto
static const QMetaObject * staticMetaObject()
static constexpr const CreateParentFunction createParent
static constexpr bool value
static constexpr bool Value
static QQmlAttachedPropertiesFunc< QObject > attachedPropertiesFunc()
static const QMetaObject * staticMetaObject()
static Func attachedPropertiesFunc()
static const QMetaObject * staticMetaObject()
static constexpr const QMetaObject * metaObject()
static constexpr bool Value
static constexpr bool Value
static constexpr bool Value
static constexpr bool Value
AutoParentFunction function
QmlUnitCacheLookupFunction lookupCachedQmlUnit
const QMetaObject * classInfoMetaObject
QMetaSequence metaSequence
QList< int > * qmlTypeIds
QMetaSequence metaSequence
const QMetaObject * instanceMetaObject
const QMetaObject * classInfoMetaObject
std::function< QObject *(QQmlEngine *, QJSEngine *)> qObjectApi
const QMetaObject * extensionMetaObject
QList< int > * qmlTypeIds
QObject *(* extensionObjectCreate)(QObject *)
std::function< QObject *(QQmlEngine *, QJSEngine *)> qObjectApi
QObject *(* extensionObjectCreate)(QObject *)
std::function< QJSValue(QQmlEngine *, QJSEngine *)> scriptApi
const QMetaObject * extensionMetaObject
const QMetaObject * instanceMetaObject
QObject *(* extensionObjectCreate)(QObject *)
QQmlAttachedPropertiesFunc< QObject > attachedPropertiesFunction
QVariant(* createValueType)(const QJSValue &)
const QMetaObject * extensionMetaObject
const QMetaObject * metaObject
void(* create)(void *, void *)
QMetaSequence listMetaSequence
const QMetaObject * classInfoMetaObject
const QMetaObject * attachedPropertiesMetaObject
QList< int > * qmlTypeIds
QQmlCustomParser * customParser
void(* create)(void *, void *)
QQmlAttachedPropertiesFunc< QObject > attachedPropertiesFunction
QVariant(* createValueType)(const QJSValue &)
const QMetaObject * extensionMetaObject
QObject *(* extensionObjectCreate)(QObject *)
const QMetaObject * metaObject
const QMetaObject * attachedPropertiesMetaObject
bool has(StructVersion v) const
ValueTypeCreationMethod creationMethod
static no_type checkType(...)
static yes_type checkType(To *)
static QVariant create(const QJSValue ¶ms)
static constexpr const CreateValueTypeFunction create
static QVariant create(const QJSValue ¶ms)
static ReturnedValue method_isView(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_get_byteLength(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_toString(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_slice(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
void init(ExecutionEngine *engine, Object *ctor)
static void virtualCallWithMetaTypes(const FunctionObject *f, QObject *thisObject, void **a, const QMetaType *types, int argc)
static ReturnedValue virtualCall(const QV4::FunctionObject *f, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc)
static QQmlRefPointer< ExecutableCompilationUnit > parse(ExecutionEngine *engine, const Value *argv, int argc, Type t=Type_Function)
static ReturnedValue method_bind(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_call(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_hasInstance(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_apply(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_toString(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
void init(QV4::ExecutionEngine *engine)
void init(QV4::ExecutionContext *scope, Function *function, QV4::String *name=nullptr)
void init(QV4::ExecutionEngine *engine)
void init(QV4::ExecutionEngine *engine, qsizetype index, VTable::Call call)
void init(QV4::ExecutionEngine *engine)
Heap::InternalClass * classForConstructor() const
static ReturnedValue virtualCall(const FunctionObject *f, const Value *thisObject, const Value *argv, int argc)
void init(ExecutionEngine *engine, Object *ctor)
static ReturnedValue method_get_byteLength(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_slice(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue slice(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc, bool shared)