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/qtyperevision.h>
34#include <QtCore/qvariant.h>
35#if !defined(QT_LEAN_HEADERS) || QT_LEAN_HEADERS < 3
36#include <QtCore/qversionnumber.h>
45class QQmlPropertyValueInterceptor;
47class QQmlFinalizerHook;
56struct ExecutionEngine;
58class ExecutableCompilationUnit;
68using QQmlAttachedPropertiesFunc = QQmlPrivate::QQmlAttachedPropertiesFunc<QObject>;
70inline size_t qHash(QQmlAttachedPropertiesFunc func, size_t seed = 0)
72 return qHash(quintptr(func), seed);
75template <
typename TYPE>
87class QQmlCustomParser;
104 class QQmlElement final :
public T
111 QQmlPrivate::qdeclarativeelement_destructor(
this);
122 static void operator
delete(
void *,
void *) {
139 template<
typename T,
typename WrapperT =
T,
typename =
std::
void_t<>>
142 static constexpr bool value =
false;
158 template<
typename Ret,
typename Class>
164 template<
typename T,
typename Marker>
172 static auto test(
int) -> std::enable_if_t<
173 QmlTypeHasMarker<U,
decltype(&U::qt_qmlMarker_uncreatable)>::value
174 &&
bool(U::QmlIsUncreatable::yes),
178 static auto test(...) -> std::false_type;
181 static constexpr bool Value =
decltype(test<T>(0))::value;
184 template<
typename T,
typename WrapperT>
187 if constexpr (!std::is_base_of<QObject, T>::value)
191 if constexpr (!std::is_same_v<T, WrapperT> && HasSingletonFactory<T, WrapperT>::value)
193 if constexpr (
std::is_default_constructible<T>::value)
195 if constexpr (HasSingletonFactory<T>::value)
202 void createInto(
void *memory,
void *) {
new (memory) QQmlElement<T>; }
212 return T::create(q, j);
214 return WrapperT::create(q, j);
227 template<
typename T,
typename WrapperT = T,
231 template<
typename T,
typename WrapperT>
241 template<
typename T,
typename WrapperT>
248 template<
typename T,
typename WrapperT>
257 template<
typename T,
typename WrapperT>
266 template<
typename T,
typename WrapperT>
303 template<
typename F,
typename Result =
void>
306 static constexpr const Result (*create)(
const QJSValue &) =
nullptr;
318 template<
typename T,
typename F,
324 template<
typename T,
typename F>
330 template<
typename T,
typename F,
bool HasCtor>
335 return F::create(params);
339 template<
typename T,
typename F>
344 return QVariant::fromValue(T(params));
348 template<
class From,
class To,
int N>
351 static inline int cast() {
return -1; }
354 template<
class From,
class To>
357 static inline int cast() {
return int(
reinterpret_cast<quintptr>(
static_cast<To *>(
reinterpret_cast<From *>(0x10000000)))) - 0x10000000; }
360 template<
class From,
class To>
377 template<
class T,
class A>
452 return QQmlAttachedPropertiesFunc<QObject>(QmlAttached<T>::attachedPropertiesFunc());
457 return QmlAttached<T>::staticMetaObject();
552 QQmlCustomParser *(*customParserFactory)();
705#if QT_QML_REMOVED_SINCE(6
, 9
)
747#if QT_QML_REMOVED_SINCE(6
, 9
)
761#if QT_QML_REMOVED_SINCE(6
, 9
)
779#if QT_QML_REMOVED_SINCE(6
, 9
)
796#if QT_QML_REMOVED_SINCE(6
, 9
)
803#if QT_QML_REMOVED_SINCE(6
, 9
)
808#if QT_QML_REMOVED_SINCE(6
, 6
)
817#if QT_QML_REMOVED_SINCE(6
, 9
)
824#if QT_QML_REMOVED_SINCE(6
, 9
)
850 template<
typename Value>
857 void (*
signature)(
QV4::ExecutableCompilationUnit *unit, QMetaType *argTypes);
858 void (*
functionPtr)(
const AOTCompiledContext *context,
void **argv);
861#if QT_DEPRECATED_SINCE(6
, 6
)
872 typedef const CachedQmlUnit *(*QmlUnitCacheLookupFunction)(
const QUrl &url);
895#if QT_DEPRECATED_SINCE(6
, 3
)
918 if (!metaObject || !key)
921 const int offset = metaObject->classInfoOffset();
922 const int start = (startOffset == -1)
923 ? (metaObject->classInfoCount() + offset - 1)
925 for (
int i = start; i >= offset; --i)
926 if (qstrcmp(key, metaObject->classInfo(i).name()) == 0) {
932 inline const char *
classInfo(
const QMetaObject *metaObject,
const char *key)
934 return metaObject->classInfo(indexOfOwnClassInfo(metaObject, key)).value();
938 QTypeRevision defaultValue = QTypeRevision())
940 const int index = indexOfOwnClassInfo(metaObject, key);
941 return (index == -1) ? defaultValue
942 : QTypeRevision::fromEncodedVersion(
943 QLatin1StringView(metaObject->classInfo(index).value()).toInt());
949 bool defaultValue =
false)
951 const int index = indexOfOwnClassInfo(metaObject, key);
954 return qstrcmp(metaObject->classInfo(index).value(),
"true") == 0;
969 static auto test(
int) -> std::conditional_t<
970 QmlTypeHasMarker<U,
decltype(&U::qt_qmlMarker_extended)>::value,
971 typename U::QmlExtendedType *,
976 static auto test(...) ->
void *;
989 static constexpr auto metaObjectImpl(
int) ->
990 decltype((
void)U::qmlExtendedNamespace(),
static_cast<
const QMetaObject *>(
nullptr))
992 if constexpr (QmlTypeHasMarker<U,
decltype(&U::qt_qmlMarker_extendedNamespace)>::value)
993 return U::qmlExtendedNamespace();
999 static constexpr auto metaObjectImpl(...) ->
const QMetaObject *
1013 static auto test(
int) -> std::conditional_t<
1014 QmlTypeHasMarker<U,
decltype(&U::qt_qmlMarker_foreign)>::value,
1015 typename U::QmlForeignType *,
1020 static auto test(...) -> U *;
1031 static auto test(
int) -> std::enable_if_t<
1032 QmlTypeHasMarker<U,
decltype(&U::qt_qmlMarker_anonymous)>::value
1033 &&
bool(U::QmlIsAnonymous::yes),
1038 static auto test(...) -> std::false_type;
1041 static constexpr bool Value =
decltype(test<T>(0))::value;
1049 static auto test(
int) -> std::enable_if_t<
1050 QmlTypeHasMarker<U,
decltype(&U::qt_qmlMarker_singleton)>::value
1051 &&
bool(U::QmlIsSingleton::yes),
1056 static auto test(...) -> std::false_type;
1059 static constexpr bool Value =
decltype(test<T>(0))::value;
1070 static auto test_impl(...) -> std::false_type;
1073 static constexpr bool test() {
1074 if constexpr (
decltype(test_impl<U>(0))::value) {
1075 static_assert((
std::is_same_v<
typename U::QmlSequenceValueType,
1083 static constexpr bool Value = test<T>();
1091 static auto test(
int) ->
1095 static auto test(...) -> std::false_type;
1098 static constexpr bool Value =
decltype(test<T>(0))::value;
1101 template<
class T,
typename =
std::
void_t<>>
1118 if constexpr (!
std::is_default_constructible_v<T>)
1120 else if constexpr (std::is_base_of_v<QObject, T>)
1123 return std::is_copy_constructible_v<T>;
1128 if constexpr (std::is_base_of_v<QObject, T>)
1129 return QMetaType::fromType<T*>();
1131 return QMetaType::fromType<T>();
1136 if constexpr (std::is_base_of_v<QObject, T>)
1137 return QMetaType::fromType<QQmlListProperty<T>>();
1139 return QMetaType::fromType<QList<T>>();
1144 if constexpr (std::is_base_of_v<QObject, T>)
1145 return QMetaSequence();
1147 return QMetaSequence::fromContainer<QList<T>>();
1163 static constexpr int size() {
return 0; }
1166 template<
typename T,
typename E,
typename WrapperT = T>
1168 const QMetaObject *classInfoMetaObject,
1169 QList<
int> *qmlTypeIds,
const QMetaObject *extension)
1171 static_assert(std::is_base_of_v<QObject, T>);
1176 QTypeRevision::fromMajorVersion(versionMajor),
1178 Constructors<T, WrapperT>::createSingletonInstance,
1180 StaticMetaObject<T>::staticMetaObject(),
1181 classInfoMetaObject,
1183 QmlMetaType<T>::self(),
1185 ExtendedType<E>::createParent,
1186 extension ? extension : ExtendedType<E>::staticMetaObject(),
1194 template<
typename T,
typename E>
1196 const QMetaObject *classInfoMetaObject,
1197 QList<
int> *qmlTypeIds,
const QMetaObject *extension,
1198 bool forceAnonymous =
false)
1202 QmlMetaType<T>::self(),
1203 QmlMetaType<T>::list(),
1204 QmlMetaType<T>::size(),
1205 Constructors<T>::createInto,
1207 ValueType<T, E>::create,
1210 QTypeRevision::fromMajorVersion(versionMajor),
1212 StaticMetaObject<T>::staticMetaObject(),
1213 classInfoMetaObject,
1215 attachedPropertiesFunc<T>(),
1216 attachedPropertiesMetaObject<T>(),
1218 StaticCastSelector<T, QQmlParserStatus>::cast(),
1219 StaticCastSelector<T, QQmlPropertyValueSource>::cast(),
1220 StaticCastSelector<T, QQmlPropertyValueInterceptor>::cast(),
1222 ExtendedType<E>::createParent,
1223 extension ? extension : ExtendedType<E>::staticMetaObject(),
1225 &qmlCreateCustomParser<T>,
1227 StaticCastSelector<T, QQmlFinalizerHook>::cast(),
1230 QmlMetaType<T>::sequence(),
1239 template<
typename T>
1241 const QMetaObject *classInfoMetaObject,
1242 QList<
int> *qmlTypeIds)
1247 QTypeRevision::fromMajorVersion(versionMajor),
1248 classInfoMetaObject,
1249 QMetaType::fromType<T>(),
1250 QMetaSequence::fromContainer<T>(),
1263 const QtPrivate::QMetaTypeInterface::MetaObjectFn &metaObjectFunction,
const char *name)
1309Q_DECLARE_OPAQUE_POINTER(QQmlV4FunctionPtr)
1310Q_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)