本文整理汇总了C++中QQmlError::isValid方法的典型用法代码示例。如果您正苦于以下问题:C++ QQmlError::isValid方法的具体用法?C++ QQmlError::isValid怎么用?C++ QQmlError::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQmlError
的用法示例。
在下文中一共展示了QQmlError::isValid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: metaCall
//.........这里部分代码省略.........
int flags = *reinterpret_cast<int*>(a[3]);
if (flags & QQmlPropertyPrivate::RemoveBindingOnAliasWrite) {
QQmlData *targetData = QQmlData::get(target);
if (targetData && targetData->hasBindingBit(d->propertyIndex())) {
QQmlAbstractBinding *binding = QQmlPropertyPrivate::setBinding(target, d->propertyIndex(), d->isValueTypeAlias()?d->valueTypeIndex():-1, 0);
if (binding) binding->destroy();
}
}
}
if (d->isValueTypeAlias()) {
// Value type property
QQmlValueType *valueType = QQmlValueTypeFactory::valueType(d->valueType());
Q_ASSERT(valueType);
valueType->read(target, d->propertyIndex());
int rv = QMetaObject::metacall(valueType, c, d->valueTypeIndex(), a);
if (c == QMetaObject::WriteProperty)
valueType->write(target, d->propertyIndex(), 0x00);
return rv;
} else {
return QMetaObject::metacall(target, c, d->propertyIndex(), a);
}
}
return -1;
}
} else if(c == QMetaObject::InvokeMetaMethod) {
if (id >= methodOffset()) {
id -= methodOffset();
int plainSignals = metaData->signalCount + metaData->propertyCount +
metaData->aliasCount;
if (id < plainSignals) {
activate(object, _id, a);
return -1;
}
id -= plainSignals;
if (id < metaData->methodCount) {
if (!ctxt->engine)
return -1; // We can't run the method
QQmlEnginePrivate *ep = QQmlEnginePrivate::get(ctxt->engine);
ep->referenceScarceResources(); // "hold" scarce resources in memory during evaluation.
QV4::Scope scope(ep->v4engine());
QV4::Scoped<QV4::FunctionObject> function(scope, method(id));
if (!function) {
// The function was not compiled. There are some exceptional cases which the
// expression rewriter does not rewrite properly (e.g., \r-terminated lines
// are not rewritten correctly but this bug is deemed out-of-scope to fix for
// performance reasons; see QTBUG-24064) and thus compilation will have failed.
QQmlError e;
e.setDescription(QString(QLatin1String("Exception occurred during compilation of function: %1")).
arg(QLatin1String(QMetaObject::method(_id).methodSignature().constData())));
ep->warning(e);
return -1; // The dynamic method with that id is not available.
}
QQmlVMEMetaData::MethodData *data = metaData->methodData() + id;
QV4::ScopedCallData callData(scope, data->parameterCount);
callData->thisObject = ep->v8engine()->global();
for (int ii = 0; ii < data->parameterCount; ++ii)
callData->args[ii] = ep->v8engine()->fromVariant(*(QVariant *)a[ii + 1]);
QV4::ScopedValue result(scope);
QV4::ExecutionContext *ctx = function->engine()->currentContext();
result = function->call(callData);
if (scope.hasException()) {
QQmlError error = QV4::ExecutionEngine::catchExceptionAsQmlError(ctx);
if (error.isValid())
ep->warning(error);
if (a[0]) *(QVariant *)a[0] = QVariant();
} else {
if (a[0]) *(QVariant *)a[0] = ep->v8engine()->toVariant(result, 0);
}
ep->dereferenceScarceResources(); // "release" scarce resources if top-level expression evaluation is complete.
return -1;
}
return -1;
}
}
if (parent.isT1())
return parent.asT1()->metaCall(object, c, _id, a);
else
return object->qt_metacall(c, _id, a);
}