summaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-08-24 18:02:14 +0200
committerKent Hansen <khansen@trolltech.com>2009-08-24 18:13:53 +0200
commitec30175915542e3b5c9cff2d807c62ad93d39a54 (patch)
tree9bc9cb9081da5767c444ea66b324e01cfe396096 /src/script
parentd6dca535c9620482d5f9d252a3d0c5dd292f6a0f (diff)
downloadqt4-tools-ec30175915542e3b5c9cff2d807c62ad93d39a54.tar.gz
add an internal QScriptValue ctor to initialize from d-pointer
Avoid having to create a dummy QScriptValue (which will have its d_ptr set to 0).
Diffstat (limited to 'src/script')
-rw-r--r--src/script/api/qscriptvalue.cpp8
-rw-r--r--src/script/api/qscriptvalue.h2
-rw-r--r--src/script/api/qscriptvalue_p.h4
3 files changed, 11 insertions, 3 deletions
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp
index b0e09ded40..494eac83af 100644
--- a/src/script/api/qscriptvalue.cpp
+++ b/src/script/api/qscriptvalue.cpp
@@ -371,6 +371,14 @@ void QScriptValuePrivate::operator delete(void *ptr)
}
/*!
+ \internal
+*/
+QScriptValue::QScriptValue(QScriptValuePrivate *d)
+ : d_ptr(d)
+{
+}
+
+/*!
Constructs an invalid QScriptValue.
*/
QScriptValue::QScriptValue()
diff --git a/src/script/api/qscriptvalue.h b/src/script/api/qscriptvalue.h
index 67b9514698..afa247ae6a 100644
--- a/src/script/api/qscriptvalue.h
+++ b/src/script/api/qscriptvalue.h
@@ -220,6 +220,8 @@ private:
// force compile error, prevent QScriptValue(QScriptEngine*, bool) to be called
inline QScriptValue(QScriptEngine *, void *);
+ QScriptValue(QScriptValuePrivate*);
+
private:
QExplicitlySharedDataPointer<QScriptValuePrivate> d_ptr;
diff --git a/src/script/api/qscriptvalue_p.h b/src/script/api/qscriptvalue_p.h
index 06bc92744d..09338658c1 100644
--- a/src/script/api/qscriptvalue_p.h
+++ b/src/script/api/qscriptvalue_p.h
@@ -96,9 +96,7 @@ public:
static inline QScriptValue toPublic(QScriptValuePrivate *d)
{
- QScriptValue tmp;
- tmp.d_ptr = d;
- return tmp;
+ return QScriptValue(d);
}
QScriptValue property(const JSC::Identifier &id, int resolveMode) const;