aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/declarative/qml/v8/qjsengine.cpp40
-rw-r--r--src/declarative/qml/v8/qjsengine.h39
-rw-r--r--src/declarative/qml/v8/qjsvalue.cpp47
-rw-r--r--src/declarative/qml/v8/qjsvalue.h54
4 files changed, 142 insertions, 38 deletions
diff --git a/src/declarative/qml/v8/qjsengine.cpp b/src/declarative/qml/v8/qjsengine.cpp
index 6bcd3ab134..270d6614f4 100644
--- a/src/declarative/qml/v8/qjsengine.cpp
+++ b/src/declarative/qml/v8/qjsengine.cpp
@@ -158,6 +158,8 @@ QJSEngine::QJSEngine()
{
}
+#ifdef QT_DEPRECATED
+
/*!
\internal
*/
@@ -166,6 +168,8 @@ QJSEngine::QJSEngine(QJSEngine::ContextOwnership ownership)
{
}
+#endif // QT_DEPRECATED
+
/*!
Constructs a QJSEngine object with the given \a parent.
@@ -198,7 +202,11 @@ QJSEngine::~QJSEngine()
\internal
*/
+#ifdef QT_DEPRECATED
+
/*!
+ \obsolete
+
Returns true if the last script evaluation resulted in an uncaught
exception; otherwise returns false.
@@ -215,6 +223,8 @@ bool QJSEngine::hasUncaughtException() const
}
/*!
+ \obsolete
+
Returns the current uncaught exception, or an invalid QJSValue
if there is no uncaught exception.
@@ -233,6 +243,8 @@ QJSValue QJSEngine::uncaughtException() const
}
/*!
+ \obsolete
+
Clears any uncaught exceptions in this engine.
\sa hasUncaughtException()
@@ -244,6 +256,7 @@ void QJSEngine::clearExceptions()
d->clearExceptions();
}
+#endif // QT_DEPRECATED
/*!
Runs the garbage collector.
@@ -298,7 +311,11 @@ QJSValue QJSEngine::evaluate(const QString& program, const QString& fileName, in
return QJSValuePrivate::get(d->evaluate(program, fileName, lineNumber));
}
+#ifdef QT_DEPRECATED
+
/*!
+ \obsolete
+
Returns a QJSValue of the primitive type Null.
\sa nullValue()
@@ -312,6 +329,8 @@ QJSValue QJSEngine::nullValue()
}
/*!
+ \obsolete
+
Returns a QJSValue of the primitive type Undefined.
\sa nullValue()
@@ -324,6 +343,8 @@ QJSValue QJSEngine::undefinedValue()
return QJSValuePrivate::get(new QJSValuePrivate(d, v8::Undefined()));
}
+#endif // QT_DEPRECATED
+
/*!
Creates a JavaScript object of class Object.
@@ -382,7 +403,11 @@ QJSValue QJSEngine::newQObject(QObject *object)
return d->scriptValueFromInternal(d->newQObject(object, QV8Engine::JavaScriptOwnership));
}
+#ifdef QT_DEPRECATED
+
/*!
+ \obsolete
+
Creates a JavaScript object holding the given variant \a value.
If a default prototype has been registered with the meta type id of
@@ -400,6 +425,7 @@ QJSValue QJSEngine::newVariant(const QVariant &value)
return d->scriptValueFromInternal(d->newVariant(value));
}
+#endif // QT_DEPRECATED
/*!
Returns this engine's Global Object.
@@ -419,7 +445,11 @@ QJSValue QJSEngine::globalObject() const
return d->scriptValueFromInternal(d->global());
}
+#ifdef QT_DEPRECATED
+
/*!
+ \obsolete
+
Converts the given \a value to an object, if such a conversion is
possible; otherwise returns an invalid QJSValue. The conversion
is performed according to the following table:
@@ -445,6 +475,8 @@ QJSValue QJSEngine::toObject(const QJSValue& value)
}
/*!
+ \obsolete
+
Creates a JavaScript object of class Date from the given \a value.
\sa QJSValue::toDateTime()
@@ -458,6 +490,8 @@ QJSValue QJSEngine::newDate(const QDateTime &dt)
}
/*!
+ \obsolete
+
Creates a JavaScript object of class Date with the given
\a value (the number of milliseconds since 01 January 1970,
UTC).
@@ -471,6 +505,8 @@ QJSValue QJSEngine::newDate(double date)
}
/*!
+ \obsolete
+
Creates a JavaScript object of class RegExp with the given
\a regexp.
@@ -485,6 +521,8 @@ QJSValue QJSEngine::newRegExp(const QRegExp &regexp)
}
/*!
+ \obsolete
+
Creates a JavaScript object of class RegExp with the given
\a pattern and \a flags.
@@ -499,6 +537,8 @@ QJSValue QJSEngine::newRegExp(const QString &pattern, const QString &flags)
return QJSValuePrivate::get(d->newRegExp(pattern, flags));
}
+#endif // QT_DEPRECATED
+
/*!
* \internal
* used by QJSEngine::toScriptValue
diff --git a/src/declarative/qml/v8/qjsengine.h b/src/declarative/qml/v8/qjsengine.h
index a6c7ca7f5e..69f2f20b52 100644
--- a/src/declarative/qml/v8/qjsengine.h
+++ b/src/declarative/qml/v8/qjsengine.h
@@ -50,13 +50,15 @@ class Q_DECLARATIVE_EXPORT QJSEngine
{
Q_OBJECT
public:
+#ifdef QT_DEPRECATED
enum ContextOwnership {
AdoptCurrentContext,
CreateNewContext
};
+ QT_DEPRECATED explicit QJSEngine(ContextOwnership ownership);
+#endif
QJSEngine();
- explicit QJSEngine(ContextOwnership ownership);
explicit QJSEngine(QObject *parent);
virtual ~QJSEngine();
@@ -64,22 +66,8 @@ public:
QJSValue evaluate(const QString &program, const QString &fileName = QString(), int lineNumber = 1);
- bool hasUncaughtException() const;
- QJSValue uncaughtException() const;
- void clearExceptions();
-
- QJSValue nullValue();
- QJSValue undefinedValue();
-
- QJSValue newVariant(const QVariant &value);
-
- QJSValue newRegExp(const QRegExp &regexp);
-
QJSValue newObject();
QJSValue newArray(uint length = 0);
- QJSValue newRegExp(const QString &pattern, const QString &flags);
- QJSValue newDate(double value);
- QJSValue newDate(const QDateTime &value);
QJSValue newQObject(QObject *object);
@@ -96,10 +84,27 @@ public:
void collectGarbage();
- QJSValue toObject(const QJSValue &value);
-
QV8Engine *handle() const { return d; }
+#ifdef QT_DEPRECATED
+ QT_DEPRECATED bool hasUncaughtException() const;
+ QT_DEPRECATED QJSValue uncaughtException() const;
+ QT_DEPRECATED void clearExceptions();
+
+ QT_DEPRECATED QJSValue nullValue();
+ QT_DEPRECATED QJSValue undefinedValue();
+
+ QT_DEPRECATED QJSValue newVariant(const QVariant &value);
+
+ QT_DEPRECATED QJSValue newRegExp(const QRegExp &regexp);
+
+ QT_DEPRECATED QJSValue newRegExp(const QString &pattern, const QString &flags);
+ QT_DEPRECATED QJSValue newDate(double value);
+ QT_DEPRECATED QJSValue newDate(const QDateTime &value);
+
+ QT_DEPRECATED QJSValue toObject(const QJSValue &value);
+#endif
+
Q_SIGNALS:
void signalHandlerException(const QJSValue &exception);
diff --git a/src/declarative/qml/v8/qjsvalue.cpp b/src/declarative/qml/v8/qjsvalue.cpp
index cd0bed3472..e8ebf079a2 100644
--- a/src/declarative/qml/v8/qjsvalue.cpp
+++ b/src/declarative/qml/v8/qjsvalue.cpp
@@ -213,6 +213,8 @@ QJSValue::QJSValue(QScriptPassPointer<QJSValuePrivate> d)
{
}
+#ifdef QT_DEPRECATED
+
/*!
\obsolete
@@ -325,6 +327,8 @@ QJSValue::QJSValue(QJSEngine* engine, SpecialValue value)
}
}
+#endif // QT_DEPRECATED
+
/*!
Constructs a new QJSValue that is a copy of \a other.
@@ -344,7 +348,11 @@ QJSValue::~QJSValue()
{
}
+#ifdef QT_DEPRECATED
+
/*!
+ \obsolete
+
Returns true if this QJSValue is valid; otherwise returns
false.
*/
@@ -355,6 +363,8 @@ bool QJSValue::isValid() const
return d->isValid();
}
+#endif // QT_DEPRECATED
+
/*!
Returns true if this QJSValue is of the primitive type Boolean;
otherwise returns false.
@@ -473,6 +483,8 @@ bool QJSValue::isCallable() const
return d->isCallable();
}
+#ifdef QT_DEPRECATED
+
/*!
\obsolete
@@ -485,6 +497,8 @@ bool QJSValue::isFunction() const
return d->isCallable();
}
+#endif // QT_DEPRECATED
+
/*!
Returns true if this QJSValue is a variant value;
otherwise returns false.
@@ -555,7 +569,11 @@ bool QJSValue::toBool() const
return d->toBool();
}
+#ifdef QT_DEPRECATED
+
/*!
+ \obsolete
+
Returns the integer value of this QJSValue, using the conversion
rules described in \l{ECMA-262} section 9.4, "ToInteger".
@@ -574,6 +592,8 @@ double QJSValue::toInteger() const
return d->toInteger();
}
+#endif // QT_DEPRECATED
+
/*!
Returns the signed 32-bit integer value of this QJSValue, using
the conversion rules described in \l{ECMA-262} section 9.5, "ToInt32".
@@ -612,6 +632,8 @@ quint32 QJSValue::toUInt() const
return d->toUInt32();
}
+#ifdef QT_DEPRECATED
+
/*!
\obsolete
@@ -667,6 +689,8 @@ QJSValue QJSValue::toObject() const
return QJSValuePrivate::get(d->toObject());
}
+#endif // QT_DEPRECATED
+
/*!
Returns the QVariant value of this QJSValue, if it can be
converted to a QVariant; otherwise returns an invalid QVariant.
@@ -772,6 +796,8 @@ QJSValue QJSValue::callAsConstructor(const QJSValueList &args)
return QJSValuePrivate::get(d->callAsConstructor(args));
}
+#ifdef QT_DEPRECATED
+
/*!
\obsolete
@@ -797,6 +823,8 @@ QJSValue QJSValue::construct(const QJSValueList &args)
}
/*!
+ \obsolete
+
Returns the QJSEngine that created this QJSValue,
or 0 if this QJSValue is invalid or the value is not
associated with a particular engine.
@@ -811,6 +839,7 @@ QJSEngine* QJSValue::engine() const
return 0;
}
+#endif // QT_DEPRECATED
/*!
If this QJSValue is an object, returns the internal prototype
@@ -919,7 +948,11 @@ bool QJSValue::strictlyEquals(const QJSValue& other) const
return d_ptr->strictlyEquals(o);
}
+#ifdef QT_DEPRECATED
+
/*!
+ \obsolete
+
Returns true if this QJSValue is an instance of
\a other; otherwise returns false.
@@ -935,6 +968,8 @@ bool QJSValue::instanceOf(const QJSValue &other) const
return d->instanceOf(QJSValuePrivate::get(other));
}
+#endif // QT_DEPRECATED
+
/*!
Returns the value of this QJSValue's property with the given \a name.
If no such property exists, an invalid QJSValue is returned.
@@ -1076,7 +1111,11 @@ bool QJSValue::hasOwnProperty(const QString &name) const
return d->hasOwnProperty(name);
}
+#ifdef QT_DEPRECATED
+
/*!
+ \obsolete
+
Returns the flags of the property with the given \a name.
\sa property()
@@ -1088,6 +1127,8 @@ QJSValue::PropertyFlags QJSValue::propertyFlags(const QString& name) const
return d->propertyFlags(name);
}
+#endif // QT_DEPRECATED
+
/*!
* If this QJSValue is a QObject, returns the QObject pointer
* that the QJSValue represents; otherwise, returns 0.
@@ -1119,7 +1160,11 @@ QDateTime QJSValue::toDateTime() const
return d->toDataTime();
}
+#ifdef QT_DEPRECATED
+
/*!
+ \obsolete
+
Returns the QRegExp representation of this value.
If this QJSValue is not a regular expression, an empty
QRegExp is returned.
@@ -1133,6 +1178,8 @@ QRegExp QJSValue::toRegExp() const
return d->toRegExp();
}
+#endif // QT_DEPRECATED
+
/*!
Returns true if this QJSValue is an object of the Date class;
otherwise returns false.
diff --git a/src/declarative/qml/v8/qjsvalue.h b/src/declarative/qml/v8/qjsvalue.h
index b6e8e6a416..ceb1d83b18 100644
--- a/src/declarative/qml/v8/qjsvalue.h
+++ b/src/declarative/qml/v8/qjsvalue.h
@@ -52,12 +52,14 @@ template <class T> class QScriptPassPointer;
class Q_DECLARATIVE_EXPORT QJSValue
{
public:
+#ifdef QT_DEPRECATED
enum PropertyFlag {
ReadOnly = 0x00000001,
Undeletable = 0x00000002,
SkipInEnumeration = 0x00000004
};
Q_DECLARE_FLAGS(PropertyFlags, PropertyFlag)
+#endif
enum SpecialValue {
NullValue,
@@ -68,12 +70,6 @@ public:
QJSValue();
~QJSValue();
QJSValue(const QJSValue &other);
- QJSValue(QJSEngine *engine, SpecialValue val);
- QJSValue(QJSEngine *engine, bool val);
- QJSValue(QJSEngine *engine, int val);
- QJSValue(QJSEngine *engine, uint val);
- QJSValue(QJSEngine *engine, double val);
- QJSValue(QJSEngine *engine, const QString &val);
QJSValue(SpecialValue value);
QJSValue(bool value);
@@ -88,11 +84,8 @@ public:
QJSValue &operator=(const QJSValue &other);
- QJSEngine *engine() const;
- bool isValid() const;
bool isBool() const;
bool isNumber() const;
- bool isFunction() const;
bool isNull() const;
bool isString() const;
bool isUndefined() const;
@@ -109,17 +102,9 @@ public:
qint32 toInt() const;
quint32 toUInt() const;
bool toBool() const;
- double toInteger() const;
- qint32 toInt32() const;
- quint32 toUInt32() const;
- quint16 toUInt16() const;
QVariant toVariant() const;
QObject *toQObject() const;
- QJSValue toObject() const;
QDateTime toDateTime() const;
- QRegExp toRegExp() const;
-
- bool instanceOf(const QJSValue &other) const;
bool equals(const QJSValue &other) const;
bool strictlyEquals(const QJSValue &other) const;
@@ -138,22 +123,47 @@ public:
bool deleteProperty(const QString &name);
- QJSValue::PropertyFlags propertyFlags(const QString &name) const;
-
bool isCallable() const;
QJSValue call(const QJSValueList &args);
QJSValue callWithInstance(const QJSValue &instance, const QJSValueList &args = QJSValueList());
QJSValue callAsConstructor(const QJSValueList &args = QJSValueList());
- QJSValue call(const QJSValue &thisObject = QJSValue(),
+
+#ifdef QT_DEPRECATED
+ QT_DEPRECATED QJSValue(QJSEngine *engine, SpecialValue val);
+ QT_DEPRECATED QJSValue(QJSEngine *engine, bool val);
+ QT_DEPRECATED QJSValue(QJSEngine *engine, int val);
+ QT_DEPRECATED QJSValue(QJSEngine *engine, uint val);
+ QT_DEPRECATED QJSValue(QJSEngine *engine, double val);
+ QT_DEPRECATED QJSValue(QJSEngine *engine, const QString &val);
+
+ QT_DEPRECATED QJSEngine *engine() const;
+
+ QT_DEPRECATED bool isValid() const;
+ QT_DEPRECATED bool isFunction() const;
+ QT_DEPRECATED double toInteger() const;
+ QT_DEPRECATED qint32 toInt32() const;
+ QT_DEPRECATED quint32 toUInt32() const;
+ QT_DEPRECATED quint16 toUInt16() const;
+ QT_DEPRECATED QJSValue toObject() const;
+ QT_DEPRECATED QRegExp toRegExp() const;
+
+ QT_DEPRECATED bool instanceOf(const QJSValue &other) const;
+
+ QT_DEPRECATED QJSValue::PropertyFlags propertyFlags(const QString &name) const;
+
+ QT_DEPRECATED QJSValue call(const QJSValue &thisObject = QJSValue(),
const QJSValueList &args = QJSValueList());
- QJSValue construct(const QJSValueList &args = QJSValueList());
+ QT_DEPRECATED QJSValue construct(const QJSValueList &args = QJSValueList());
+#endif
private:
// force compile error, prevent QJSValue(bool) to be called
QJSValue(void *);
+#ifdef QT_DEPRECATED
// force compile error, prevent QJSValue(QScriptEngine*, bool) to be called
QJSValue(QJSEngine *, void *);
QJSValue(QJSEngine *, const char *);
+#endif
QJSValue(QJSValuePrivate*);
QJSValue(QScriptPassPointer<QJSValuePrivate>);
@@ -164,7 +174,9 @@ private:
Q_DECLARE_PRIVATE(QJSValue)
};
+#ifdef QT_DEPRECATED
Q_DECLARE_OPERATORS_FOR_FLAGS(QJSValue::PropertyFlags)
+#endif
QT_END_NAMESPACE