本文整理汇总了C++中QScriptValue::data方法的典型用法代码示例。如果您正苦于以下问题:C++ QScriptValue::data方法的具体用法?C++ QScriptValue::data怎么用?C++ QScriptValue::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScriptValue
的用法示例。
在下文中一共展示了QScriptValue::data方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setProperty
void QDiagramPluginLoaderClass::setProperty( QScriptValue & object, const QScriptString &name, uint id, const QScriptValue & value )
{
QDiagramPluginLoader *c= qscriptvalue_cast<QDiagramPluginLoader*>(object.data());
if (!c){
return;
}
}
示例2: QScriptClassPropertyIterator
ReflectivePropertyIterator::ReflectivePropertyIterator(
const QScriptValue& object) :
QScriptClassPropertyIterator(object),
m_idx(-1)
{
m_node = qscriptvalue_cast< Node_ptr >(object.data());
}
示例3: toScriptValue
QScriptValue SearchResultsScriptClass::toScriptValue(QScriptEngine *eng, const SearchResults &searchResults)
{
QScriptValue ctor = eng->globalObject().property("SearchResults");
SearchResultsScriptClass *cls = qscriptvalue_cast<SearchResultsScriptClass*>(ctor.data());
if (!cls) return eng->newVariant(qVariantFromValue(searchResults));
return cls->newInstance(searchResults);
}
示例4: toByteArray
QByteArray FilePrototype::toByteArray(const QScriptValue &value)
{
ByteArrayClass *cls = getByteArrayClass(engine());
return (cls && value.scriptClass() == cls)
? *qscriptvalue_cast<QByteArray*>(value.data())
: value.toString().toUtf8();
}
示例5: toScriptValue
QScriptValue ByteArrayClass::toScriptValue(QScriptEngine *eng, const QByteArray &ba) {
QScriptValue ctor = eng->globalObject().property("ByteArray");
ByteArrayClass *cls = qscriptvalue_cast<ByteArrayClass*>(ctor.data());
if (!cls)
return eng->newVariant(QVariant::fromValue(ba));
return cls->newInstance(ba);
}
示例6: propertyFlags
QScriptValue::PropertyFlags DefaultScriptClass::propertyFlags(const QScriptValue& object, const QScriptString& name, uint id)
{
QScriptValue::PropertyFlags result;
const ScriptHandlerInfo::Mode mode = mHandlerInfo->mode();
Q_ASSERT(mode != ScriptHandlerInfo::None);
DataInformation* data = toDataInformation(object);
if (!data)
{
mHandlerInfo->logger()->error() << "could not cast data from" << object.data().toString();
engine()->currentContext()->throwError(QScriptContext::ReferenceError,
QStringLiteral("Attempting to access an invalid object"));
return 0;
}
if (name == s_valid || name == s_validationError)
{
if (mode != ScriptHandlerInfo::Validating)
result |= QScriptValue::ReadOnly;
}
else if (mode != ScriptHandlerInfo::Updating)
{
result |= QScriptValue::ReadOnly;
}
for (int i = 0, size = mIterableProperties.size(); i < size; ++i) {
if (mIterableProperties.at(i).first == name)
return result | mIterableProperties.at(i).second;
}
if (additionalPropertyFlags(data, name, id, &result))
return result; //is a child element
else
{
data->logError() << "could not find flags for property with name" << name.toString();
return 0;
}
}
示例7: property
QScriptValue ArrayBufferClass::property(const QScriptValue& object,
const QScriptString& name, uint id) {
QByteArray* ba = qscriptvalue_cast<QByteArray*>(object.data());
if (ba && name == _byteLength) {
return ba->length();
}
return QScriptValue();
}
示例8: toScriptValue
QScriptValue post_data_list_class::toScriptValue(QScriptEngine *eng, const http_data_list &pdl)
{
QScriptValue ctor = eng->globalObject().property("post_data_list");
post_data_list_class *cls = qscriptvalue_cast<post_data_list_class*>(ctor.data());
if (!cls)
return eng->newVariant(QVariant::fromValue(pdl));
return cls->newInstance(pdl);
}
示例9: setProperty
void setProperty(QScriptValue &object,
const QScriptString &name, uint, const QScriptValue & value)
{
if (name == str_forwardOnly) {
QSqlQuery query = qscriptvalue_cast<QSqlQuery>(object.data());
query.setForwardOnly(value.toBool());
}
}
示例10: property
QScriptValue QDiagramPluginLoaderClass::property(const QScriptValue &object, const QScriptString & name, uint id)
{
QDiagramPluginLoader* c = qscriptvalue_cast<QDiagramPluginLoader*>(object.data());
if (!c){
return QScriptValue();
}
return QScriptValue();
}
示例11: toScriptValue
QScriptValue QDiagramPluginLoaderClass::toScriptValue(QScriptEngine* engine, const QDiagramPluginLoader & o)
{
QScriptValue ctor = engine->globalObject().property("QDiagramPluginLoader");
QDiagramPluginLoaderClass* c = qscriptvalue_cast<QDiagramPluginLoaderClass*>(ctor.data());
if (!c){
return engine->newVariant(qVariantFromValue(c));
}
return c->newInstance(o);
}
示例12: property
QScriptValue TypedArray::property(const QScriptValue& object,
const QScriptString& name, uint id) {
if (name == _bytesPerElementName) {
return QScriptValue(_bytesPerElement);
}
if (name == _lengthName) {
return object.data().property(_lengthName);
}
return ArrayBufferViewClass::property(object, name, id);
}
示例13: queryProperty
QScriptClass::QueryFlags ArrayBufferClass::queryProperty(const QScriptValue& object,
const QScriptString& name,
QueryFlags flags, uint* id) {
QByteArray* ba = qscriptvalue_cast<QByteArray*>(object.data());
if (ba && name == _byteLength) {
// if the property queried is byteLength, only handle read access
return flags &= HandlesReadAccess;
}
return 0; // No access
}
示例14: queryProperty
QScriptClass::QueryFlags TypedArray::queryProperty(const QScriptValue& object,
const QScriptString& name,
QueryFlags flags, uint* id) {
if (name == _bytesPerElementName || name == _lengthName) {
return flags &= HandlesReadAccess; // Only keep read access flags
}
quint32 byteOffset = object.data().property(_byteOffsetName).toInt32();
quint32 length = object.data().property(_lengthName).toInt32();
bool ok = false;
quint32 pos = name.toArrayIndex(&ok);
// Check that name is a valid index and arrayBuffer exists
if (ok && pos < length) {
*id = byteOffset + pos * _bytesPerElement; // save pos to avoid recomputation
return HandlesReadAccess | HandlesWriteAccess; // Read/Write access
}
return ArrayBufferViewClass::queryProperty(object, name, flags, id);
}
示例15: toScriptValue
QScriptValue ArrayBufferClass::toScriptValue(QScriptEngine* engine, const QByteArray& ba) {
QScriptValue ctor = engine->globalObject().property(CLASS_NAME);
ArrayBufferClass* cls = qscriptvalue_cast<ArrayBufferClass*>(ctor.data());
if (!cls) {
if (engine->currentContext()) {
engine->currentContext()->throwError("arrayBufferClass::toScriptValue -- could not get " + CLASS_NAME + " class constructor");
}
return QScriptValue::NullValue;
}
return cls->newInstance(ba);
}