aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4qobjectwrapper_p.h
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2016-09-07 13:31:14 +0200
committerErik Verbruggen <erik.verbruggen@qt.io>2016-09-27 08:37:39 +0000
commitc08423ac01be53a40226b30e62d2d50d1fca9fd5 (patch)
treebf5803dcfd215b3f53f18e0479971cb2a4d3b5ad /src/qml/jsruntime/qv4qobjectwrapper_p.h
parent480037f2988f5b3010bd6a444cda8e28a24571fd (diff)
QML: Replace QPointer with a QQmlQPointer (which is trivial)
One of the steps needed to make QV4::Heap::structs trivial. Change-Id: Ic4d73f15035af21c8a682aaad1ee68cdd91f8e7d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4qobjectwrapper_p.h')
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper_p.h28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h
index f0dbd82a63..076f304fea 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper_p.h
+++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h
@@ -79,18 +79,28 @@ struct QQmlValueTypeWrapper;
struct QObjectWrapper : Object {
QObjectWrapper(QObject *object);
- QPointer<QObject> object;
+ ~QObjectWrapper() { qObj.destroy(); }
+
+ QObject *object() const { return qObj.data(); }
+
+private:
+ QQmlQPointer<QObject> qObj;
};
struct QObjectMethod : FunctionObject {
QObjectMethod(QV4::ExecutionContext *scope);
- QPointer<QObject> object;
+ ~QObjectMethod() { qObj.destroy(); }
QQmlRefPointer<QQmlPropertyCache> propertyCache;
int index;
Pointer<QQmlValueTypeWrapper> valueTypeWrapper;
const QMetaObject *metaObject();
+ QObject *object() const { return qObj.data(); }
+ void setObject(QObject *o) { qObj = o; }
+
+private:
+ QQmlQPointer<QObject> qObj;
};
struct QMetaObjectWrapper : FunctionObject {
@@ -105,8 +115,14 @@ struct QMetaObjectWrapper : FunctionObject {
struct QmlSignalHandler : Object {
QmlSignalHandler(QObject *object, int signalIndex);
- QPointer<QObject> object;
+ ~QmlSignalHandler() { qObj.destroy(); }
int signalIndex;
+
+ QObject *object() const { return qObj.data(); }
+ void setObject(QObject *o) { qObj = o; }
+
+private:
+ QQmlQPointer<QObject> qObj;
};
}
@@ -119,7 +135,7 @@ struct Q_QML_EXPORT QObjectWrapper : public Object
static void initializeBindings(ExecutionEngine *engine);
- QObject *object() const { return d()->object.data(); }
+ QObject *object() const { return d()->object(); }
ReturnedValue getQmlProperty(QQmlContextData *qmlContext, String *name, RevisionMode revisionMode, bool *hasProperty = 0, bool includeImports = false) const;
static ReturnedValue getQmlProperty(ExecutionEngine *engine, QQmlContextData *qmlContext, QObject *object, String *name, RevisionMode revisionMode, bool *hasProperty = 0);
@@ -189,7 +205,7 @@ struct Q_QML_EXPORT QObjectMethod : public QV4::FunctionObject
static ReturnedValue create(QV4::ExecutionContext *scope, const QQmlValueTypeWrapper *valueType, int index);
int methodIndex() const { return d()->index; }
- QObject *object() const { return d()->object.data(); }
+ QObject *object() const { return d()->object(); }
QV4::ReturnedValue method_toString(QV4::ExecutionContext *ctx) const;
QV4::ReturnedValue method_destroy(QV4::ExecutionContext *ctx, const Value *args, int argc) const;
@@ -230,7 +246,7 @@ struct Q_QML_EXPORT QmlSignalHandler : public QV4::Object
V4_NEEDS_DESTROY
int signalIndex() const { return d()->signalIndex; }
- QObject *object() const { return d()->object.data(); }
+ QObject *object() const { return d()->object(); }
static void initProto(ExecutionEngine *v4);
};