6.0.0-rc4Source

QQmlError Class

The QQmlError class describes an error in a QML document. More…

Header#include <QQmlError>
CMaketarget_link_libraries(app PRIVATE Nt::Qml)
ModuleNt Qml C++ Classes

List of all members, including inherited members

Public Functions

QQmlError()
boolisValid() const
QUrlurl() const
voidsetUrl(const QUrl &url)
QStringdescription() const
voidsetDescription(const QString &description)
intline() const
voidsetLine(int line)
intcolumn() const
voidsetColumn(int column)
QtMsgTypemessageType() const
voidsetMessageType(QtMsgType messageType)
QStringtoString() const

Detailed Description

for (const QQmlError &e : component.errors())
    qWarning() << e.url() << e.line() << e.description();

See also QQmlComponent::errors() and QQmlEngine::warnings().

Differences from Qt

There is no object() or swap().

Member Function Documentation

QQmlError::QQmlError()

Constructs an empty error.

int QQmlError::column() const

Returns the column, from 1, or -1 if it is not known.

QString QQmlError::description() const

Returns the description.

bool QQmlError::isValid() const

Returns true if the error has a URL and a description; otherwise returns false.

int QQmlError::line() const

Returns the line, from 1, or -1 if it is not known.

QtMsgType QQmlError::messageType() const

Returns the type of the message, QtWarningMsg by default.

void QQmlError::setColumn(int column)

Sets the column to column.

void QQmlError::setDescription(const QString &description)

Sets the description to description.

void QQmlError::setLine(int line)

Sets the line to line.

void QQmlError::setMessageType(QtMsgType messageType)

Sets the type of the message to messageType.

void QQmlError::setUrl(const QUrl &url)

Sets the URL of the document to url.

QString QQmlError::toString() const

Returns the error as "url:line:column: description".

QUrl QQmlError::url() const

Returns the URL of the document.