diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2012-01-18 13:12:00 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-20 23:35:18 +0100 |
commit | 846b66d46a1e0f4f0baf9bed387c588f6faf8e0c (patch) | |
tree | eb7053e1240ffb27ceb8140b1f78e44b34a9f872 /src/declarative/qml/v8/qjsvalue.cpp | |
parent | 23805ae47898a1ae4b5c8d8bb30b8b69d2fc435a (diff) |
Add QJSValue::toInt() and toUInt()
These replace toInt32() and toUInt32(), which are obsolete and will
be removed.
Task-number: QTBUG-23604
Change-Id: I83c055dbbe399fa7242889cee8a177440a693d9a
Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Diffstat (limited to 'src/declarative/qml/v8/qjsvalue.cpp')
-rw-r--r-- | src/declarative/qml/v8/qjsvalue.cpp | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/src/declarative/qml/v8/qjsvalue.cpp b/src/declarative/qml/v8/qjsvalue.cpp index 9d21a1db28..482216ac49 100644 --- a/src/declarative/qml/v8/qjsvalue.cpp +++ b/src/declarative/qml/v8/qjsvalue.cpp @@ -515,7 +515,7 @@ QString QJSValue::toString() const attempt to convert the object to a primitive value (possibly resulting in an uncaught script exception). - \sa isNumber(), toInteger(), toInt32(), toUInt32(), toUInt16() + \sa isNumber(), toInteger(), toInt(), toUInt(), toUInt16() */ double QJSValue::toNumber() const { @@ -572,9 +572,9 @@ double QJSValue::toInteger() const attempt to convert the object to a primitive value (possibly resulting in an uncaught script exception). - \sa toNumber(), toUInt32() + \sa toNumber(), toUInt() */ -qint32 QJSValue::toInt32() const +qint32 QJSValue::toInt() const { Q_D(const QJSValue); QScriptIsolate api(d->engine()); @@ -591,7 +591,31 @@ qint32 QJSValue::toInt32() const attempt to convert the object to a primitive value (possibly resulting in an uncaught script exception). - \sa toNumber(), toInt32() + \sa toNumber(), toInt() +*/ +quint32 QJSValue::toUInt() const +{ + Q_D(const QJSValue); + QScriptIsolate api(d->engine()); + return d->toUInt32(); +} + +/*! + \obsolete + + Use toInt() instead. +*/ +qint32 QJSValue::toInt32() const +{ + Q_D(const QJSValue); + QScriptIsolate api(d->engine()); + return d->toInt32(); +} + +/*! + \obsolete + + Use toUInt() instead. */ quint32 QJSValue::toUInt32() const { |