本文整理汇总了C++中QQmlError::description方法的典型用法代码示例。如果您正苦于以下问题:C++ QQmlError::description方法的具体用法?C++ QQmlError::description怎么用?C++ QQmlError::description使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQmlError
的用法示例。
在下文中一共展示了QQmlError::description方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: qmlBinding
QV4::ReturnedValue QQmlJavaScriptExpression::qmlBinding(QQmlContextData *ctxt, QObject *qmlScope,
const QString &code, const QString &filename, quint16 line,
QV4::PersistentValue *qmlscope)
{
QQmlEngine *engine = ctxt->engine;
QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine);
QV4::ExecutionEngine *v4 = QV8Engine::getV4(ep->v8engine());
QV4::ExecutionContext *ctx = v4->currentContext();
QV4::Scope scope(v4);
QV4::ScopedObject qmlScopeObject(scope, QV4::QmlContextWrapper::qmlScope(ep->v8engine(), ctxt, qmlScope));
QV4::Script script(v4, qmlScopeObject, code, filename, line);
QV4::ScopedValue result(scope);
script.parse();
if (!v4->hasException)
result = script.qmlBinding();
if (v4->hasException) {
QQmlError error = QV4::ExecutionEngine::catchExceptionAsQmlError(ctx);
if (error.description().isEmpty())
error.setDescription(QLatin1String("Exception occurred during function evaluation"));
if (error.line() == -1)
error.setLine(line);
if (error.url().isEmpty())
error.setUrl(QUrl::fromLocalFile(filename));
error.setObject(qmlScope);
ep->warning(error);
return QV4::Encode::undefined();
}
if (qmlscope)
*qmlscope = qmlScopeObject;
return result.asReturnedValue();
}
示例2: copy
void tst_qqmlerror::copy()
{
QQmlError error;
error.setUrl(QUrl("http://www.qt-project.org/main.qml"));
error.setDescription("An Error");
error.setLine(92);
error.setColumn(13);
QQmlError error2(error);
QQmlError error3;
error3 = error;
error.setUrl(QUrl("http://www.qt-project.org/main.qml"));
error.setDescription("Another Error");
error.setLine(2);
error.setColumn(33);
QCOMPARE(error.url(), QUrl("http://www.qt-project.org/main.qml"));
QCOMPARE(error.description(), QString("Another Error"));
QCOMPARE(error.line(), 2);
QCOMPARE(error.column(), 33);
QCOMPARE(error2.url(), QUrl("http://www.qt-project.org/main.qml"));
QCOMPARE(error2.description(), QString("An Error"));
QCOMPARE(error2.line(), 92);
QCOMPARE(error2.column(), 13);
QCOMPARE(error3.url(), QUrl("http://www.qt-project.org/main.qml"));
QCOMPARE(error3.description(), QString("An Error"));
QCOMPARE(error3.line(), 92);
QCOMPARE(error3.column(), 13);
}
示例3: qmlErrorToString
static QString qmlErrorToString(const QQmlError &error)
{
return QStringLiteral("%1:%2:%3: %4")
.arg(error.url().toString())
.arg(error.line())
.arg(error.column())
.arg(error.description());
}
示例4:
foreach(QQmlError warning, warnings)
{
QString url;
if (warning.url().isLocalFile())
url = warning.url().toLocalFile();
else
url = warning.url().toString();
qCWarning(sambaLogQml, "%s:%d: %s", url.toLocal8Bit().constData(),
warning.line(), warning.description().toLocal8Bit().constData());
}
示例5: description
void tst_qqmlerror::description()
{
QQmlError error;
QCOMPARE(error.description(), QString());
error.setDescription("An Error");
QCOMPARE(error.description(), QString("An Error"));
QQmlError error2 = error;
QCOMPARE(error2.description(), QString("An Error"));
error.setDescription("Another Error");
QCOMPARE(error.description(), QString("Another Error"));
QCOMPARE(error2.description(), QString("An Error"));
}
示例6: setError
void QQmlDirParser::setError(const QQmlError &e)
{
_errors.clear();
reportError(e.line(), e.column(), e.description());
}