summaryrefslogtreecommitdiffstats
path: root/src/script
diff options
context:
space:
mode:
Diffstat (limited to 'src/script')
-rw-r--r--src/script/api/qscriptengine.cpp9
-rw-r--r--src/script/api/qscriptengine.h45
2 files changed, 31 insertions, 23 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index a7a20c1..ee02b9d 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -2442,6 +2442,7 @@ QScriptValue QScriptEngine::newQMetaObject(
\fn QScriptValue qScriptValueFromQMetaObject(QScriptEngine *engine)
\since 4.3
\relates QScriptEngine
+ \obsolete
Uses \a engine to create a QScriptValue that represents the Qt class
\c{T}.
@@ -3762,6 +3763,7 @@ QStringList QScriptEngine::importedExtensions() const
\fn QScriptValue qScriptValueFromValue(QScriptEngine *engine, const T &value)
\since 4.3
\relates QScriptEngine
+ \obsolete
Creates a QScriptValue using the given \a engine with the given \a
value of template type \c{T}.
@@ -3772,13 +3774,14 @@ QStringList QScriptEngine::importedExtensions() const
which did not support member template functions. It is advised
to use the other form in new code.
- \sa qScriptValueToValue()
+ \sa QScriptEngine::toScriptValue(), qscriptvalue_cast
*/
/*!
\fn T qScriptValueToValue(const QScriptValue &value)
\since 4.3
\relates QScriptEngine
+ \obsolete
Returns the given \a value converted to the template type \c{T}.
@@ -3788,7 +3791,7 @@ QStringList QScriptEngine::importedExtensions() const
which did not support member template functions. It is advised
to use the other form in new code.
- \sa qScriptValueFromValue()
+ \sa QScriptEngine::fromScriptValue()
*/
/*!
@@ -3807,7 +3810,7 @@ QStringList QScriptEngine::importedExtensions() const
\l{Conversion Between QtScript and C++ Types} for more information
about the restrictions on types that can be used with QScriptValue.
- \sa qScriptValueFromValue()
+ \sa QScriptEngine::fromScriptValue()
*/
/*!
diff --git a/src/script/api/qscriptengine.h b/src/script/api/qscriptengine.h
index 6add6ed..eafd40c 100644
--- a/src/script/api/qscriptengine.h
+++ b/src/script/api/qscriptengine.h
@@ -69,7 +69,7 @@ template <typename T>
inline QScriptValue qScriptValueFromValue(QScriptEngine *, const T &);
template <typename T>
-inline T qScriptValueToValue(const QScriptValue &);
+inline T qscriptvalue_cast(const QScriptValue &);
class QScriptSyntaxCheckResultPrivate;
class Q_SCRIPT_EXPORT QScriptSyntaxCheckResult
@@ -217,7 +217,7 @@ public:
template <typename T>
inline T fromScriptValue(const QScriptValue &value)
{
- return qScriptValueToValue<T>(value);
+ return qscriptvalue_cast<T>(value);
}
void installTranslatorFunctions(const QScriptValue &object = QScriptValue());
@@ -279,19 +279,6 @@ private:
};
#ifndef QT_NO_QOBJECT
-template <class T>
-inline QScriptValue qScriptValueFromQMetaObject(
- QScriptEngine *engine
-#ifndef qdoc
- , T * /* dummy */ = 0
-#endif
- )
-{
- typedef QScriptValue(*ConstructPtr)(QScriptContext *, QScriptEngine *, T *);
- ConstructPtr cptr = qscriptQMetaObjectConstructor<T>;
- return engine->newQMetaObject(&T::staticMetaObject,
- engine->newFunction(reinterpret_cast<QScriptEngine::FunctionWithArgSignature>(cptr), 0));
-}
#define Q_SCRIPT_DECLARE_QMETAOBJECT(T, _Arg1) \
template<> inline QScriptValue qscriptQMetaObjectConstructor<T>(QScriptContext *ctx, QScriptEngine *eng, T *) \
@@ -305,10 +292,26 @@ template<> inline QScriptValue qscriptQMetaObjectConstructor<T>(QScriptContext *
return o; \
}
- template <class T> QScriptValue QScriptEngine::scriptValueFromQMetaObject()
- {
- return qScriptValueFromQMetaObject<T>(this);
- }
+template <class T> QScriptValue QScriptEngine::scriptValueFromQMetaObject()
+{
+ typedef QScriptValue(*ConstructPtr)(QScriptContext *, QScriptEngine *, T *);
+ ConstructPtr cptr = qscriptQMetaObjectConstructor<T>;
+ return newQMetaObject(&T::staticMetaObject,
+ newFunction(reinterpret_cast<FunctionWithArgSignature>(cptr), 0));
+}
+
+#ifdef QT_DEPRECATED
+template <class T>
+inline QT_DEPRECATED QScriptValue qScriptValueFromQMetaObject(
+ QScriptEngine *engine
+#ifndef qdoc
+ , T * /* dummy */ = 0
+#endif
+ )
+{
+ return engine->scriptValueFromQMetaObject<T>();
+}
+#endif
#endif // QT_NO_QOBJECT
@@ -360,11 +363,13 @@ inline QVariant qscriptvalue_cast<QVariant>(const QScriptValue &value)
return value.toVariant();
}
+#ifdef QT_DEPRECATED
template <typename T>
-inline T qScriptValueToValue(const QScriptValue &value)
+inline QT_DEPRECATED T qScriptValueToValue(const QScriptValue &value)
{
return qscriptvalue_cast<T>(value);
}
+#endif
inline void qScriptRegisterMetaType_helper(QScriptEngine *eng, int type,
QScriptEngine::MarshalFunction mf,