summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-07-15 09:45:00 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-07-15 09:45:00 (GMT)
commit25e41f5bbf3ad288a6b2f9eec0fbef7c5b171744 (patch)
tree161087ed0d0502c4fddc6805ca8329487bfeab2b
parent630444819350b9f7a31c34798405c4e6fd53dc62 (diff)
downloadQt-25e41f5bbf3ad288a6b2f9eec0fbef7c5b171744.zip
Qt-25e41f5bbf3ad288a6b2f9eec0fbef7c5b171744.tar.gz
Qt-25e41f5bbf3ad288a6b2f9eec0fbef7c5b171744.tar.bz2
implement QObject prototype object
-rw-r--r--src/script/bridge/qscriptqobject.cpp5
-rw-r--r--src/script/bridge/qscriptqobject_p.h9
2 files changed, 13 insertions, 1 deletions
diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp
index 3705e5f..4f19894 100644
--- a/src/script/bridge/qscriptqobject.cpp
+++ b/src/script/bridge/qscriptqobject.cpp
@@ -1561,7 +1561,10 @@ QObjectPrototype::QObjectPrototype(JSC::ExecState* exec, WTF::PassRefPtr<JSC::St
JSC::Structure* prototypeFunctionStructure)
: QScriptObject(structure)
{
- setDelegate(new QObjectDelegate(new QObject(), QScriptEngine::AutoOwnership, /*options=*/0));
+ setDelegate(new QObjectDelegate(new QObjectPrototypeObject(), QScriptEngine::AutoOwnership,
+ QScriptEngine::ExcludeSuperClassMethods
+ | QScriptEngine::ExcludeSuperClassProperties
+ | QScriptEngine::ExcludeChildObjects));
putDirectFunction(exec, new (exec) JSC::PrototypeFunction(exec, prototypeFunctionStructure, /*length=*/0, exec->propertyNames().toString, qobjectProtoFuncToString), JSC::DontEnum);
putDirectFunction(exec, new (exec) JSC::PrototypeFunction(exec, prototypeFunctionStructure, /*length=*/1, JSC::Identifier(exec, "findChild"), qobjectProtoFuncFindChild), JSC::DontEnum);
diff --git a/src/script/bridge/qscriptqobject_p.h b/src/script/bridge/qscriptqobject_p.h
index 9008599..766c3c7 100644
--- a/src/script/bridge/qscriptqobject_p.h
+++ b/src/script/bridge/qscriptqobject_p.h
@@ -96,6 +96,15 @@ protected:
Data *data;
};
+class QObjectPrototypeObject : public QObject
+{
+ Q_OBJECT
+public:
+ QObjectPrototypeObject(QObject *parent = 0)
+ : QObject(parent) { }
+ ~QObjectPrototypeObject() { }
+};
+
class QObjectPrototype : public QScriptObject
{
public: