summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/script/api/qscriptvalue.cpp6
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp29
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.cpp4
-rw-r--r--translations/qt_de.ts46
4 files changed, 83 insertions, 2 deletions
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp
index 451d1b0..f6390bb 100644
--- a/src/script/api/qscriptvalue.cpp
+++ b/src/script/api/qscriptvalue.cpp
@@ -1268,6 +1268,7 @@ QDateTime QScriptValue::toDateTime() const
Q_D(const QScriptValue);
if (!d || !d->engine)
return QDateTime();
+ QScript::APIShim shim(d->engine);
return QScriptEnginePrivate::toDateTime(d->engine->currentFrame, d->jscValue);
}
@@ -1284,6 +1285,7 @@ QRegExp QScriptValue::toRegExp() const
Q_D(const QScriptValue);
if (!d || !d->engine)
return QRegExp();
+ QScript::APIShim shim(d->engine);
return QScriptEnginePrivate::toRegExp(d->engine->currentFrame, d->jscValue);
}
#endif // QT_NO_REGEXP
@@ -1303,6 +1305,7 @@ QObject *QScriptValue::toQObject() const
Q_D(const QScriptValue);
if (!d || !d->engine)
return 0;
+ QScript::APIShim shim(d->engine);
return QScriptEnginePrivate::toQObject(d->engine->currentFrame, d->jscValue);
}
@@ -1317,6 +1320,7 @@ const QMetaObject *QScriptValue::toQMetaObject() const
Q_D(const QScriptValue);
if (!d || !d->engine)
return 0;
+ QScript::APIShim shim(d->engine);
return QScriptEnginePrivate::toQMetaObject(d->engine->currentFrame, d->jscValue);
}
@@ -1407,6 +1411,7 @@ QScriptValue QScriptValue::property(quint32 arrayIndex,
Q_D(const QScriptValue);
if (!d || !d->isObject())
return QScriptValue();
+ QScript::APIShim shim(d->engine);
return d->engine->scriptValueFromJSCValue(d->property(arrayIndex, mode));
}
@@ -1434,6 +1439,7 @@ void QScriptValue::setProperty(quint32 arrayIndex, const QScriptValue &value,
"cannot set value created in a different engine");
return;
}
+ QScript::APIShim shim(d->engine);
JSC::JSValue jsValue = d->engine->scriptValueToJSCValue(value);
d->setProperty(arrayIndex, jsValue, flags);
}
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index 6885adf..7a732cc 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -4265,6 +4265,35 @@ void tst_QScriptEngine::reentrancy()
QScriptEngine eng;
QCOMPARE(eng.evaluate("Array()").toString(), QString());
}
+
+ {
+ QScriptEngine eng1;
+ QScriptEngine eng2;
+ {
+ QScriptValue d1 = eng1.newDate(0);
+ QScriptValue d2 = eng2.newDate(0);
+ QCOMPARE(d1.toDateTime(), d2.toDateTime());
+ QCOMPARE(d2.toDateTime(), d1.toDateTime());
+ }
+ {
+ QScriptValue r1 = eng1.newRegExp("foo", "gim");
+ QScriptValue r2 = eng2.newRegExp("foo", "gim");
+ QCOMPARE(r1.toRegExp(), r2.toRegExp());
+ QCOMPARE(r2.toRegExp(), r1.toRegExp());
+ }
+ {
+ QScriptValue o1 = eng1.newQObject(this);
+ QScriptValue o2 = eng2.newQObject(this);
+ QCOMPARE(o1.toQObject(), o2.toQObject());
+ QCOMPARE(o2.toQObject(), o1.toQObject());
+ }
+ {
+ QScriptValue mo1 = eng1.newQMetaObject(&staticMetaObject);
+ QScriptValue mo2 = eng2.newQMetaObject(&staticMetaObject);
+ QCOMPARE(mo1.toQMetaObject(), mo2.toQMetaObject());
+ QCOMPARE(mo2.toQMetaObject(), mo1.toQMetaObject());
+ }
+ }
}
void tst_QScriptEngine:: incDecNonObjectProperty()
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
index 8aa4e711..83a3388 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
@@ -2123,6 +2123,10 @@ void tst_QScriptValue::getSetProperty()
QVERIFY(object.property(foo).strictlyEquals(num));
QVERIFY(object.property("foo").strictlyEquals(num));
QVERIFY(object.propertyFlags(foo) == 0);
+
+ // Setting index property on non-Array
+ object.setProperty(13, num);
+ QVERIFY(object.property(13).equals(num));
}
void tst_QScriptValue::arrayElementGetterSetter()
diff --git a/translations/qt_de.ts b/translations/qt_de.ts
index 7d32ead..74bd048 100644
--- a/translations/qt_de.ts
+++ b/translations/qt_de.ts
@@ -2024,6 +2024,11 @@ nach
<translation>Signalnamen dürfen nicht mit einem Großbuchstaben beginnen</translation>
</message>
<message>
+ <location line="+2"/>
+ <source>Illegal signal name</source>
+ <translation>Ungültiger Name für Signal</translation>
+ </message>
+ <message>
<location line="+6"/>
<source>Duplicate method name</source>
<translation>Mehrfaches Auftreten eines Methodennamens</translation>
@@ -2034,6 +2039,11 @@ nach
<translation>Methodennamen dürfen nicht mit einem Großbuchstaben beginnen</translation>
</message>
<message>
+ <location line="+2"/>
+ <source>Illegal method name</source>
+ <translation>Ungültiger Name für Methode</translation>
+ </message>
+ <message>
<location line="+21"/>
<source>Property value set multiple times</source>
<translation>Mehrfache Zuweisung eines Wertes an eine Eigenschaft</translation>
@@ -7713,21 +7723,53 @@ Bitte wählen Sie einen anderen Dateinamen.</translation>
<translation>Kontext4</translation>
</message>
<message>
- <location line="+1"/>
+ <location line="+2"/>
<source>Call</source>
+ <extracomment>Button to start a call (note: a separate button is used to end the call)</extracomment>
<translation>Anruf</translation>
</message>
<message>
- <location line="+1"/>
+ <location line="+2"/>
<source>Hangup</source>
+ <extracomment>Button to end a call (note: a separate button is used to start the call)</extracomment>
<translation>Auflegen</translation>
</message>
<message>
+ <location line="+2"/>
+ <source>Toggle Call/Hangup</source>
+ <extracomment>Button that will hang up if we&apos;re in call, or make a call if we&apos;re not.</extracomment>
+ <translation>Anrufen/Aufhängen</translation>
+ </message>
+ <message>
<location line="+1"/>
<source>Flip</source>
<translation>Umdrehen</translation>
</message>
<message>
+ <location line="+2"/>
+ <source>Voice Dial</source>
+ <extracomment>Button to trigger voice dialling</extracomment>
+ <translation>Sprachwahl</translation>
+ </message>
+ <message>
+ <location line="+2"/>
+ <source>Last Number Redial</source>
+ <extracomment>Button to redial the last number called</extracomment>
+ <translation>Wahlwiederholung</translation>
+ </message>
+ <message>
+ <location line="+2"/>
+ <source>Camera Shutter</source>
+ <extracomment>Button to trigger the camera shutter (take a picture)</extracomment>
+ <translation>Auslöser</translation>
+ </message>
+ <message>
+ <location line="+2"/>
+ <source>Camera Focus</source>
+ <extracomment>Button to focus the camera</extracomment>
+ <translation>Scharfstellen</translation>
+ </message>
+ <message>
<location line="+4"/>
<source>Kanji</source>
<translation>Kanji</translation>