4#ifndef QV4QOBJECTWRAPPER_P_H
5#define QV4QOBJECTWRAPPER_P_H
18#include <private/qbipointer_p.h>
19#include <private/qintrusivelist_p.h>
20#include <private/qqmldata_p.h>
21#include <private/qv4functionobject_p.h>
22#include <private/qv4lookup_p.h>
23#include <private/qv4value_p.h>
25#include <QtCore/qglobal.h>
26#include <QtCore/qmetatype.h>
27#include <QtCore/qpair.h>
28#include <QtCore/qhash.h>
39struct QObjectSlotDispatcher;
43struct QQmlValueTypeWrapper;
61 QV4QPointer<QObject> qObj;
64#define QObjectMethodMembers(class, Member) \
65 Member(class, Pointer, Object *, wrapper) \
80 FunctionObject::destroy();
83 void ensureMethodsCache(
const QMetaObject *thisMeta);
89 bool isDetached()
const;
98 QV4::Heap::QObjectMethod::ThisObjectMode checkThisObject(
const QMetaObject *thisMeta)
const;
113 QV4QPointer<QObject> qObj;
128 IncludeImports = 0x8,
138 return o->metaObject();
146 Flags flags,
bool *hasProperty =
nullptr)
const;
153 static bool setQmlProperty(
157 Q_NODISCARD_X(
"Use ensureWrapper if you don't need the return value")
172 void destroyObject(
bool lastCall);
181 template <typename ReversalFunctor> static
ReturnedValue lookupPropertyGetterImpl(
184 template <typename ReversalFunctor> static
ReturnedValue lookupMethodGetterImpl(
187 static
bool virtualResolveLookupSetter(
231 if (
Q_LIKELY(ddata && ddata->jsEngineId ==
engine->m_engineId && !ddata->jsWrapper.isUndefined())) {
233 return ddata->jsWrapper.value();
236 return wrap_slowPath(
engine,
object);
245 return wrapConst_slowPath(
engine,
object);
253 fromMo = fromMo->parent().data();
258template <
typename ReversalFunctor>
261 QObjectWrapper::Flags
flags, ReversalFunctor revertLookup)
265 Heap::Object *
o =
static_cast<Heap::Object *
>(
object.heapObject());
267 return revertLookup();
276 return revertLookup();
279 if (ddata->propertyCache.data() != lookup->
qobjectLookup.propertyCache) {
283 && ((
flags & AllowOverride)
286 return revertLookup();
290 return revertLookup();
296template <
typename ReversalFunctor>
299 QObjectWrapper::Flags
flags, ReversalFunctor revertLookup)
303 Heap::Object *
o =
static_cast<Heap::Object *
>(
object.heapObject());
305 return revertLookup();
314 return revertLookup();
319 return revertLookup();
322 return revertLookup();
327 return method->asReturnedValue();
331 return revertLookup();
336 return revertLookup();
339 return v->asReturnedValue();
349 enum { DestroyMethod = -1, ToStringMethod = -2 };
356 Heap::Object *
wrapper, Heap::Object *
object);
370 static void virtualCallWithMetaTypes(
375 const Value *thisObject,
const Value *argv,
int argc)
const;
376 void callInternalWithMetaTypes(
415 private QHash<QObjectBiPointer, QV4::WeakValue>
429 template<
typename Po
inter>
436 template<
typename Po
inter>
447 template<
typename Po
inter>
456 template<
typename Po
inter>
462 it->markOnce(markStack);
466 void removeDestroyedObject(
QObject*);
static JNINativeMethod methods[]
iterator begin()
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first item in the hash.
T & operator[](const Key &key)
Returns the value associated with the key as a modifiable reference.
const_iterator constEnd() const noexcept
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the ...
const_iterator constBegin() const noexcept
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item in the hash.
iterator end() noexcept
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the last ...
static bool wasDeleted(const QObject *)
static QQmlData * get(QObjectPrivate *priv, bool create)
\macro QT_RESTRICTED_CAST_FROM_ASCII
void insert(Pointer key, Heap::Object *value)
QHash< QObjectBiPointer, QV4::WeakValue >::ConstIterator ConstIterator
void mark(Pointer key, MarkStack *markStack)
ConstIterator end() const
QHash< QObjectBiPointer, QV4::WeakValue >::Iterator Iterator
ReturnedValue value(Pointer key) const
ConstIterator begin() const
QHash< QObjectBiPointer, QV4::WeakValue >::value_type value_type
ReturnedValue value() const
QSet< QString >::iterator it
Combined button and popup list for selecting options.
QBiPointer< QObject, const QObject > QObjectBiPointer
bool canConvert(const QQmlPropertyCache *fromMo, const QQmlPropertyCache *toMo)
qsizetype erase(QByteArray &ba, const T &t)
#define Q_NODISCARD_X(message)
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
static QDBusError::ErrorType get(const char *name)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
GLsizei const GLfloat * v
[13]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLsizei GLenum GLenum * types
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
QQmlContext * qmlContext(const QObject *obj)
static QT_BEGIN_NAMESPACE QAsn1Element wrap(quint8 type, const QAsn1Element &child)
static QT_BEGIN_NAMESPACE void init(QTextBoundaryFinder::BoundaryType type, QStringView str, QCharAttributes *attributes)
#define DECLARE_EXPORTED_HEAP_OBJECT(name, base)
#define DECLARE_MARKOBJECTS(class)
#define V4_OBJECT2(DataClass, superClass)
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)
obj metaObject() -> className()
args<< 1<< 2;QJSValue threeAgain=fun.call(args);QString fileName="helloworld.qs";QFile scriptFile(fileName);if(!scriptFile.open(QIODevice::ReadOnly)) QTextStream stream(&scriptFile);QString contents=stream.readAll();scriptFile.close();myEngine.evaluate(contents, fileName);myEngine.globalObject().setProperty("myNumber", 123);...QJSValue myNumberPlusOne=myEngine.evaluate("myNumber + 1");QJSValue result=myEngine.evaluate(...);if(result.isError()) qDebug()<< "Uncaught exception at line"<< result.property("lineNumber").toInt()<< ":"<< result.toString();QPushButton *button=new QPushButton;QJSValue scriptButton=myEngine.newQObject(button);myEngine.globalObject().setProperty("button", scriptButton);myEngine.evaluate("button.checkable = true");qDebug()<< scriptButton.property("checkable").toBool();scriptButton.property("show").call();QJSEngine engine;QObject *myQObject=new QObject();myQObject- setProperty)("dynamicProperty", 3)
static constexpr ReturnedValue undefined()
static constexpr ReturnedValue null()
void init(QObject *object)
void init(QObject *object, int signalIndex)
void setObject(QObject *o)
struct QV4::Lookup::@583::@599 qobjectMethodLookup
struct QV4::Lookup::@583::@598 qobjectLookup
void method_destroy(QV4::ExecutionEngine *engine, QObject *o, void **argv, const QMetaType *types, int argc) const
ReturnedValue getQmlProperty(const QQmlRefPointer< QQmlContextData > &qmlContext, String *name, Flags flags, bool *hasProperty=nullptr) const
Q_DECLARE_FLAGS(Flags, Flag)
static ReturnedValue getQmlProperty(ExecutionEngine *engine, const QQmlRefPointer< QQmlContextData > &qmlContext, Heap::Object *wrapper, QObject *object, String *name, Flags flags, bool *hasProperty=nullptr, const QQmlPropertyData **property=nullptr)
const QMetaObject * metaObject() const
V4_NEEDS_DESTROY int signalIndex() const