Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qqmltypeloaderqmldircontent.cpp
Go to the documentation of this file.
1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include <private/qqmltypeloaderqmldircontent_p.h>
5#include <private/qqmlsourcecoordinate_p.h>
6#include <QtQml/qqmlerror.h>
7
9
10QList<QQmlError> QQmlTypeLoaderQmldirContent::errors(const QString &uri, const QUrl &url) const
11{
12 QList<QQmlError> errors;
13 const auto parseErrors = m_parser.errors(uri);
14 for (const auto &parseError : parseErrors) {
16 error.setUrl(url);
17 error.setLine(qmlConvertSourceCoordinate<quint32, int>(parseError.loc.startLine));
18 error.setColumn(qmlConvertSourceCoordinate<quint32, int>(parseError.loc.startColumn));
19 error.setDescription(parseError.message);
21 }
22 return errors;
23}
24
25void QQmlTypeLoaderQmldirContent::setContent(const QString &location, const QString &content)
26{
27 Q_ASSERT(!m_hasContent);
28 m_hasContent = true;
29 m_location = location;
30 m_parser.parse(content);
32}
33
34void QQmlTypeLoaderQmldirContent::setError(const QQmlError &error)
35{
37 parseError.loc.startLine = error.line();
38 parseError.loc.startColumn = error.column();
39 parseError.message = error.description();
40 m_parser.setError(parseError);
41}
42
void append(parameter_type t)
Definition qlist.h:458
void setError(const QQmlJS::DiagnosticMessage &)
QList< QQmlJS::DiagnosticMessage > errors(const QString &uri) const
void disambiguateFileSelectors()
bool parse(const QString &source)
url is used for generating errors.
The QQmlError class encapsulates a QML error.
Definition qqmlerror.h:18
QList< QQmlError > errors(const QString &uri, const QUrl &url) const
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qurl.h:94
Combined button and popup list for selecting options.
DBusConnection const char DBusError * error
GLint location
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
QUrl url("example.com")
[constructor-url-reference]