diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-08-25 15:20:13 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-08-26 14:56:56 +0200 |
commit | bb1e23d8f02451f92a9fa0f2570de4dce065170c (patch) | |
tree | 12dc85d09f321bd4681b2bf562c5a7ea5f33bbb0 | |
parent | 8ded1241cc9bd1fee463cd40769840bc3dcc142c (diff) |
Remove deprecated function QJSValue::engine
[ChangeLog][QJSValue] The deprecated function QJSValue::engine() has
been removed.
Change-Id: I2be35379e0a9e51f5371a2c98b955282955b7147
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
-rw-r--r-- | src/qml/jsapi/qjsvalue.cpp | 19 | ||||
-rw-r--r-- | src/qml/jsapi/qjsvalue.h | 3 | ||||
-rw-r--r-- | tests/auto/qml/qjsengine/tst_qjsengine.cpp | 3 | ||||
-rw-r--r-- | tests/auto/qml/qjsvalue/tst_qjsvalue.cpp | 80 |
4 files changed, 0 insertions, 105 deletions
diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp index a3cf034096..663f6ced82 100644 --- a/src/qml/jsapi/qjsvalue.cpp +++ b/src/qml/jsapi/qjsvalue.cpp @@ -742,25 +742,6 @@ QJSValue QJSValue::callAsConstructor(const QJSValueList &args) const return QJSValuePrivate::fromReturnedValue(result->asReturnedValue()); } -#ifdef QT_DEPRECATED - -/*! - \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. -*/ -QJSEngine* QJSValue::engine() const -{ - QV4::ExecutionEngine *engine = QJSValuePrivate::engine(this); - if (engine) - return engine->jsEngine(); - return nullptr; -} - -#endif // QT_DEPRECATED - /*! If this QJSValue is an object, returns the internal prototype (\c{__proto__} property) of this object; otherwise returns an diff --git a/src/qml/jsapi/qjsvalue.h b/src/qml/jsapi/qjsvalue.h index 091f353291..3da76d16cb 100644 --- a/src/qml/jsapi/qjsvalue.h +++ b/src/qml/jsapi/qjsvalue.h @@ -149,9 +149,6 @@ public: QJSValue callAsConstructor(const QJSValueList &args = QJSValueList()) const; ErrorType errorType() const; -#ifdef QT_DEPRECATED - QT_DEPRECATED QJSEngine *engine() const; -#endif private: friend class QJSValuePrivate; diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp index 8ac1e14e52..cd03903da2 100644 --- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp +++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp @@ -4331,9 +4331,6 @@ void tst_QJSEngine::engineForObject() QJSValue wrapper = engine.newQObject(&object); QQmlEngine::setObjectOwnership(&object, QQmlEngine::CppOwnership); QVERIFY(qjsEngine(&object)); -#ifdef QT_DEPRECATED - QCOMPARE(qjsEngine(&object), wrapper.engine()); -#endif } QVERIFY(!qjsEngine(&object)); } diff --git a/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp b/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp index 9a0394c7bd..903d372cfb 100644 --- a/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp +++ b/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp @@ -52,9 +52,6 @@ void tst_QJSValue::ctor_invalid() { QJSValue v; QVERIFY(v.isUndefined()); -#ifdef QT_DEPRECATED - QCOMPARE(v.engine(), (QJSEngine *)nullptr); -#endif } } @@ -65,9 +62,6 @@ void tst_QJSValue::ctor_undefinedWithEngine() QJSValue v = eng.toScriptValue(QVariant()); QVERIFY(v.isUndefined()); QCOMPARE(v.isObject(), false); -#ifdef QT_DEPRECATED - QCOMPARE(v.engine(), nullptr); // undefined is not managed -#endif } } @@ -79,9 +73,6 @@ void tst_QJSValue::ctor_nullWithEngine() QVERIFY(!v.isUndefined()); QCOMPARE(v.isNull(), true); QCOMPARE(v.isObject(), false); -#ifdef QT_DEPRECATED - QCOMPARE(v.engine(), nullptr); // null is not managed -#endif } } @@ -94,9 +85,6 @@ void tst_QJSValue::ctor_boolWithEngine() QCOMPARE(v.isBool(), true); QCOMPARE(v.isObject(), false); QCOMPARE(v.toBool(), false); -#ifdef QT_DEPRECATED - QCOMPARE(v.engine(), nullptr); // bool is not managed -#endif } } @@ -109,9 +97,6 @@ void tst_QJSValue::ctor_intWithEngine() QCOMPARE(v.isNumber(), true); QCOMPARE(v.isObject(), false); QCOMPARE(v.toNumber(), 1.0); -#ifdef QT_DEPRECATED - QCOMPARE(v.engine(), nullptr); // int is not managed -#endif } } @@ -128,9 +113,6 @@ void tst_QJSValue::ctor_int() QCOMPARE(v.isNumber(), true); QCOMPARE(v.isObject(), false); QCOMPARE(v.toNumber(), 1.0); -#ifdef QT_DEPRECATED - QCOMPARE(v.engine(), (QJSEngine *)nullptr); -#endif } } @@ -143,9 +125,6 @@ void tst_QJSValue::ctor_uintWithEngine() QCOMPARE(v.isNumber(), true); QCOMPARE(v.isObject(), false); QCOMPARE(v.toNumber(), 1.0); -#ifdef QT_DEPRECATED - QCOMPARE(v.engine(), nullptr); // uint is not managed -#endif } } @@ -162,9 +141,6 @@ void tst_QJSValue::ctor_uint() QCOMPARE(v.isNumber(), true); QCOMPARE(v.isObject(), false); QCOMPARE(v.toNumber(), 1.0); -#ifdef QT_DEPRECATED - QCOMPARE(v.engine(), (QJSEngine *)nullptr); -#endif } } @@ -177,9 +153,6 @@ void tst_QJSValue::ctor_floatWithEngine() QCOMPARE(v.isNumber(), true); QCOMPARE(v.isObject(), false); QCOMPARE(v.toNumber(), 1.0); -#ifdef QT_DEPRECATED - QCOMPARE(v.engine(), nullptr); // float is not managed -#endif } } @@ -196,9 +169,6 @@ void tst_QJSValue::ctor_float() QCOMPARE(v.isNumber(), true); QCOMPARE(v.isObject(), false); QCOMPARE(v.toNumber(), 1.0); -#ifdef QT_DEPRECATED - QCOMPARE(v.engine(), (QJSEngine *)nullptr); -#endif } } @@ -211,9 +181,6 @@ void tst_QJSValue::ctor_stringWithEngine() QCOMPARE(v.isString(), true); QCOMPARE(v.isObject(), false); QCOMPARE(v.toString(), QLatin1String("ciao")); -#ifdef QT_DEPRECATED - QCOMPARE(v.engine(), &eng); -#endif } } @@ -225,9 +192,6 @@ void tst_QJSValue::ctor_string() QCOMPARE(v.isString(), true); QCOMPARE(v.isObject(), false); QCOMPARE(v.toString(), QLatin1String("ciao")); -#ifdef QT_DEPRECATED - QCOMPARE(v.engine(), (QJSEngine *)nullptr); -#endif } { QJSValue v("ciao"); @@ -235,9 +199,6 @@ void tst_QJSValue::ctor_string() QCOMPARE(v.isString(), true); QCOMPARE(v.isObject(), false); QCOMPARE(v.toString(), QLatin1String("ciao")); -#ifdef QT_DEPRECATED - QCOMPARE(v.engine(), (QJSEngine *)nullptr); -#endif } } @@ -249,16 +210,10 @@ void tst_QJSValue::ctor_copyAndAssignWithEngine() QJSValue v = eng.toScriptValue(1.0); QJSValue v2(v); QCOMPARE(v2.strictlyEquals(v), true); -#ifdef QT_DEPRECATED - QCOMPARE(v2.engine(), nullptr); // not managed -#endif QJSValue v3(v); QCOMPARE(v3.strictlyEquals(v), true); QCOMPARE(v3.strictlyEquals(v2), true); -#ifdef QT_DEPRECATED - QCOMPARE(v3.engine(), nullptr); // not managed -#endif QJSValue v4 = eng.toScriptValue(2.0); QCOMPARE(v4.strictlyEquals(v), false); @@ -283,9 +238,6 @@ void tst_QJSValue::ctor_undefined() QJSValue v(QJSValue::UndefinedValue); QVERIFY(v.isUndefined()); QCOMPARE(v.isObject(), false); -#ifdef QT_DEPRECATED - QCOMPARE(v.engine(), (QJSEngine *)nullptr); -#endif } void tst_QJSValue::ctor_null() @@ -294,9 +246,6 @@ void tst_QJSValue::ctor_null() QVERIFY(!v.isUndefined()); QCOMPARE(v.isNull(), true); QCOMPARE(v.isObject(), false); -#ifdef QT_DEPRECATED - QCOMPARE(v.engine(), (QJSEngine *)nullptr); -#endif } void tst_QJSValue::ctor_bool() @@ -307,9 +256,6 @@ void tst_QJSValue::ctor_bool() QCOMPARE(v.isBool(), true); QCOMPARE(v.isObject(), false); QCOMPARE(v.toBool(), false); -#ifdef QT_DEPRECATED - QCOMPARE(v.engine(), (QJSEngine *)nullptr); -#endif } void tst_QJSValue::ctor_copyAndAssign() @@ -317,16 +263,10 @@ void tst_QJSValue::ctor_copyAndAssign() QJSValue v(1.0); QJSValue v2(v); QCOMPARE(v2.strictlyEquals(v), true); -#ifdef QT_DEPRECATED - QCOMPARE(v2.engine(), (QJSEngine *)nullptr); -#endif QJSValue v3(v); QCOMPARE(v3.strictlyEquals(v), true); QCOMPARE(v3.strictlyEquals(v2), true); -#ifdef QT_DEPRECATED - QCOMPARE(v3.engine(), (QJSEngine *)nullptr); -#endif QJSValue v4(2.0); QCOMPARE(v4.strictlyEquals(v), false); @@ -463,9 +403,6 @@ void tst_QJSValue::toString() QCOMPARE(o.toString(), QStringLiteral("[object Object]")); o = createUnboundValue(o); -#ifdef QT_DEPRECATED - QVERIFY(!o.engine()); -#endif QEXPECT_FAIL("", "We cannot save and restore objects to/from a data stream", Continue); QCOMPARE(o.toString(), QStringLiteral("[object Object]")); } @@ -478,9 +415,6 @@ void tst_QJSValue::toString() QCOMPARE(o.toString(), QStringLiteral("1,2,3")); o = createUnboundValue(o); -#ifdef QT_DEPRECATED - QVERIFY(!o.engine()); -#endif QEXPECT_FAIL("", "We cannot save and restore arrays to/from a data stream", Continue); QCOMPARE(o.toString(), QStringLiteral("1,2,3")); } @@ -1653,14 +1587,8 @@ void tst_QJSValue::getSetProperty() QCOMPARE(object.property("baz").toNumber(), num.toNumber()); QJSValue strstr = QJSValue("bar"); -#ifdef QT_DEPRECATED - QCOMPARE(strstr.engine(), (QJSEngine *)nullptr); -#endif object.setProperty("foo", strstr); QCOMPARE(object.property("foo").toString(), strstr.toString()); -#ifdef QT_DEPRECATED - QVERIFY(strstr.engine() != &eng); // the value has not been bound to the engine -#endif QJSValue numnum = QJSValue(123.0); object.setProperty("baz", numnum); @@ -2567,14 +2495,6 @@ void tst_QJSValue::engineDeleted() QVERIFY(v4.isUndefined()); QVERIFY(v5.isString()); // was not bound to engine -#ifdef QT_DEPRECATED - QVERIFY(!v1.engine()); - QVERIFY(!v2.engine()); - QVERIFY(!v3.engine()); - QVERIFY(!v4.engine()); - QVERIFY(!v5.engine()); -#endif - QVERIFY(v3.property("foo").isUndefined()); } |