diff options
Diffstat (limited to 'src/script/api/qscriptengine.cpp')
-rw-r--r-- | src/script/api/qscriptengine.cpp | 52 |
1 files changed, 21 insertions, 31 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 8347626..d35d680 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -1730,7 +1730,7 @@ QVariant QScriptEnginePrivate::toVariant(JSC::ExecState *exec, JSC::JSValue valu return variantValue(value); #ifndef QT_NO_QOBJECT else if (isQObject(value)) - return qVariantFromValue(toQObject(exec, value)); + return QVariant::fromValue(toQObject(exec, value)); #endif else if (isDate(value)) return QVariant(toDateTime(exec, value)); @@ -2454,10 +2454,6 @@ QScriptValue QScriptEngine::newQMetaObject( \snippet doc/src/snippets/code/src_script_qscriptengine.cpp 13 - \warning This function is not available with MSVC 6. Use - qScriptValueFromQMetaObject() instead if you need to support that version - of the compiler. - \sa QScriptEngine::newQMetaObject() */ @@ -2465,14 +2461,17 @@ 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}. This function is equivalent to - QScriptEngine::scriptValueFromQMetaObject(). It is provided as a - work-around for MSVC 6, which doesn't support member template - functions. + QScriptEngine::scriptValueFromQMetaObject(). + + \note This function was provided as a workaround for MSVC 6 + which did not support member template functions. It is advised + to use the other form in new code. \sa QScriptEngine::newQMetaObject() */ @@ -3003,14 +3002,7 @@ JSC::JSValue QScriptEnginePrivate::create(JSC::ExecState *exec, int type, const case QMetaType::LongLong: return JSC::jsNumber(exec, qsreal(*reinterpret_cast<const qlonglong*>(ptr))); case QMetaType::ULongLong: -#if defined(Q_OS_WIN) && defined(_MSC_FULL_VER) && _MSC_FULL_VER <= 12008804 -#pragma message("** NOTE: You need the Visual Studio Processor Pack to compile support for 64bit unsigned integers.") - return JSC::jsNumber(exec, qsreal((qlonglong)*reinterpret_cast<const qulonglong*>(ptr))); -#elif defined(Q_CC_MSVC) && !defined(Q_CC_MSVC_NET) - return JSC::jsNumber(exec, qsreal((qlonglong)*reinterpret_cast<const qulonglong*>(ptr))); -#else return JSC::jsNumber(exec, qsreal(*reinterpret_cast<const qulonglong*>(ptr))); -#endif case QMetaType::Double: return JSC::jsNumber(exec, qsreal(*reinterpret_cast<const double*>(ptr))); case QMetaType::QString: @@ -3054,7 +3046,7 @@ JSC::JSValue QScriptEnginePrivate::create(JSC::ExecState *exec, int type, const break; #endif case QMetaType::QVariant: - result = jscValueFromVariant(exec, *reinterpret_cast<const QVariant*>(ptr)); + result = eng->newVariant(*reinterpret_cast<const QVariant*>(ptr)); break; default: if (type == qMetaTypeId<QScriptValue>()) { @@ -3772,10 +3764,6 @@ QStringList QScriptEngine::importedExtensions() const to newVariant()); you can change this behavior by installing your own type conversion functions with qScriptRegisterMetaType(). - \warning This function is not available with MSVC 6. Use - qScriptValueFromValue() instead if you need to support that - version of the compiler. - \sa fromScriptValue(), qScriptRegisterMetaType() */ @@ -3789,10 +3777,6 @@ QStringList QScriptEngine::importedExtensions() const description of the built-in type conversion provided by QtScript. - \warning This function is not available with MSVC 6. Use - qScriptValueToValue() or qscriptvalue_cast() instead if you need - to support that version of the compiler. - \sa toScriptValue(), qScriptRegisterMetaType() */ @@ -3800,29 +3784,35 @@ 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}. This function is equivalent to QScriptEngine::toScriptValue(). - It is provided as a work-around for MSVC 6, which doesn't support - member template functions. - \sa qScriptValueToValue() + \note This function was provided as a workaround for MSVC 6 + which did not support member template functions. It is advised + to use the other form in new code. + + \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}. This function is equivalent to QScriptEngine::fromScriptValue(). - It is provided as a work-around for MSVC 6, which doesn't - support member template functions. - \sa qScriptValueFromValue() + \note This function was provided as a workaround for MSVC 6 + which did not support member template functions. It is advised + to use the other form in new code. + + \sa QScriptEngine::fromScriptValue() */ /*! @@ -3841,7 +3831,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() */ /*! |