equal
deleted
inserted
replaced
1213 \row \o String \o A QVariant containing the value of the string. |
1213 \row \o String \o A QVariant containing the value of the string. |
1214 \row \o QVariant Object \o The result is the QVariant value of the object (no conversion). |
1214 \row \o QVariant Object \o The result is the QVariant value of the object (no conversion). |
1215 \row \o QObject Object \o A QVariant containing a pointer to the QObject. |
1215 \row \o QObject Object \o A QVariant containing a pointer to the QObject. |
1216 \row \o Date Object \o A QVariant containing the date value (toDateTime()). |
1216 \row \o Date Object \o A QVariant containing the date value (toDateTime()). |
1217 \row \o RegExp Object \o A QVariant containing the regular expression value (toRegExp()). |
1217 \row \o RegExp Object \o A QVariant containing the regular expression value (toRegExp()). |
1218 \row \o Array Object \o The array is converted to a QVariantList. |
1218 \row \o Array Object \o The array is converted to a QVariantList. Each element is converted to a QVariant, recursively; cyclic references are not followed. |
1219 \row \o Object \o If the value is primitive, then the result is converted to a QVariant according to the above rules; otherwise, an invalid QVariant is returned. |
1219 \row \o Object \o The object is converted to a QVariantMap. Each property is converted to a QVariant, recursively; cyclic references are not followed. |
1220 \endtable |
1220 \endtable |
1221 |
1221 |
1222 \sa isVariant() |
1222 \sa isVariant() |
1223 */ |
1223 */ |
1224 QVariant QScriptValue::toVariant() const |
1224 QVariant QScriptValue::toVariant() const |
1266 QDateTime QScriptValue::toDateTime() const |
1266 QDateTime QScriptValue::toDateTime() const |
1267 { |
1267 { |
1268 Q_D(const QScriptValue); |
1268 Q_D(const QScriptValue); |
1269 if (!d || !d->engine) |
1269 if (!d || !d->engine) |
1270 return QDateTime(); |
1270 return QDateTime(); |
|
1271 QScript::APIShim shim(d->engine); |
1271 return QScriptEnginePrivate::toDateTime(d->engine->currentFrame, d->jscValue); |
1272 return QScriptEnginePrivate::toDateTime(d->engine->currentFrame, d->jscValue); |
1272 } |
1273 } |
1273 |
1274 |
1274 #ifndef QT_NO_REGEXP |
1275 #ifndef QT_NO_REGEXP |
1275 /*! |
1276 /*! |
1282 QRegExp QScriptValue::toRegExp() const |
1283 QRegExp QScriptValue::toRegExp() const |
1283 { |
1284 { |
1284 Q_D(const QScriptValue); |
1285 Q_D(const QScriptValue); |
1285 if (!d || !d->engine) |
1286 if (!d || !d->engine) |
1286 return QRegExp(); |
1287 return QRegExp(); |
|
1288 QScript::APIShim shim(d->engine); |
1287 return QScriptEnginePrivate::toRegExp(d->engine->currentFrame, d->jscValue); |
1289 return QScriptEnginePrivate::toRegExp(d->engine->currentFrame, d->jscValue); |
1288 } |
1290 } |
1289 #endif // QT_NO_REGEXP |
1291 #endif // QT_NO_REGEXP |
1290 |
1292 |
1291 /*! |
1293 /*! |
1301 QObject *QScriptValue::toQObject() const |
1303 QObject *QScriptValue::toQObject() const |
1302 { |
1304 { |
1303 Q_D(const QScriptValue); |
1305 Q_D(const QScriptValue); |
1304 if (!d || !d->engine) |
1306 if (!d || !d->engine) |
1305 return 0; |
1307 return 0; |
|
1308 QScript::APIShim shim(d->engine); |
1306 return QScriptEnginePrivate::toQObject(d->engine->currentFrame, d->jscValue); |
1309 return QScriptEnginePrivate::toQObject(d->engine->currentFrame, d->jscValue); |
1307 } |
1310 } |
1308 |
1311 |
1309 /*! |
1312 /*! |
1310 If this QScriptValue is a QMetaObject, returns the QMetaObject pointer |
1313 If this QScriptValue is a QMetaObject, returns the QMetaObject pointer |
1315 const QMetaObject *QScriptValue::toQMetaObject() const |
1318 const QMetaObject *QScriptValue::toQMetaObject() const |
1316 { |
1319 { |
1317 Q_D(const QScriptValue); |
1320 Q_D(const QScriptValue); |
1318 if (!d || !d->engine) |
1321 if (!d || !d->engine) |
1319 return 0; |
1322 return 0; |
|
1323 QScript::APIShim shim(d->engine); |
1320 return QScriptEnginePrivate::toQMetaObject(d->engine->currentFrame, d->jscValue); |
1324 return QScriptEnginePrivate::toQMetaObject(d->engine->currentFrame, d->jscValue); |
1321 } |
1325 } |
1322 |
1326 |
1323 /*! |
1327 /*! |
1324 Sets the value of this QScriptValue's property with the given \a name to |
1328 Sets the value of this QScriptValue's property with the given \a name to |
1405 const ResolveFlags &mode) const |
1409 const ResolveFlags &mode) const |
1406 { |
1410 { |
1407 Q_D(const QScriptValue); |
1411 Q_D(const QScriptValue); |
1408 if (!d || !d->isObject()) |
1412 if (!d || !d->isObject()) |
1409 return QScriptValue(); |
1413 return QScriptValue(); |
|
1414 QScript::APIShim shim(d->engine); |
1410 return d->engine->scriptValueFromJSCValue(d->property(arrayIndex, mode)); |
1415 return d->engine->scriptValueFromJSCValue(d->property(arrayIndex, mode)); |
1411 } |
1416 } |
1412 |
1417 |
1413 /*! |
1418 /*! |
1414 \overload |
1419 \overload |
1432 && (QScriptValuePrivate::getEngine(value) != d->engine)) { |
1437 && (QScriptValuePrivate::getEngine(value) != d->engine)) { |
1433 qWarning("QScriptValue::setProperty() failed: " |
1438 qWarning("QScriptValue::setProperty() failed: " |
1434 "cannot set value created in a different engine"); |
1439 "cannot set value created in a different engine"); |
1435 return; |
1440 return; |
1436 } |
1441 } |
|
1442 QScript::APIShim shim(d->engine); |
1437 JSC::JSValue jsValue = d->engine->scriptValueToJSCValue(value); |
1443 JSC::JSValue jsValue = d->engine->scriptValueToJSCValue(value); |
1438 d->setProperty(arrayIndex, jsValue, flags); |
1444 d->setProperty(arrayIndex, jsValue, flags); |
1439 } |
1445 } |
1440 |
1446 |
1441 /*! |
1447 /*! |