QmlError Class | Extending Qt Creator Manual

Extending Qt Creator Manual | QmlError

Extending Qt Creator Manual 4.8.1

# QmlError Class

The QmlError class encapsulates a QML error. More...

Header: | #include <QmlError>
Since: | Qt 5.0

- List of all members, including inherited members

## Public Functions

| QmlError()
| QmlError(const QmlError &other)
int | column() const
int | description() const
bool | isValid() const
int | line() const
int | messageType() const
int * | object() const
void | setColumn(int column)
void | setDescription(const int &description)
void | setLine(int line)
void | setMessageType(int messageType)
void | setObject(int *object)
void | setUrl(const int &url)
int | toString() const
int | url() const
QmlError & | operator=(const QmlError &other)

## Detailed Description

The QmlError class encapsulates a QML error.

QmlError includes a textual description of the error, as well as location information (the file, line, and column). The toString() method creates a single-line, human-readable string containing all of this information, for example:

      file:///home/user/test.qml:7:8: Invalid property assignment: double expected

You can use qDebug(), qInfo(), or qWarning() to output errors to the console. This method will attempt to open the file indicated by the error and include additional contextual information.

      file:///home/user/test.qml:7:8: Invalid property assignment: double expected
              y: "hello"
                 ^

Note that the Qt Quick 1 version is named QDeclarativeError

See also QQuickView::errors() and QmlComponent::errors().

## Member Type Documentation

## Property Documentation

## Member Function Documentation

### QmlError::QmlError()

Creates an empty error object.

### QmlError::QmlError(const QmlError &other)

Creates a copy of other.

### int QmlError::column() const

Returns the error column number.

See also setColumn().

### int QmlError::description() const

Returns the error description.

See also setDescription().

### bool QmlError::isValid() const

Returns true if this error is valid, otherwise false.

### int QmlError::line() const

Returns the error line number.

See also setLine().

### int QmlError::messageType() const

Returns the message type.

This function was introduced in Qt 5.9.

See also setMessageType().

### int *QmlError::object() const

Returns the nearest object where this error occurred. Exceptions in bound property expressions set this to the object to which the property belongs. It will be 0 for all other exceptions.

See also setObject().

### void QmlError::setColumn(int column)

Sets the error column number.

See also column().

### void QmlError::setDescription(const int &description)

Sets the error description.

See also description().

### void QmlError::setLine(int line)

Sets the error line number.

See also line().

### void QmlError::setMessageType(int messageType)

Sets the messageType for this message. The message type determines which QDebug handlers are responsible for recieving the message.

This function was introduced in Qt 5.9.

See also messageType().

### void QmlError::setObject(int *object)

Sets the nearest object where this error occurred.

See also object().

### void QmlError::setUrl(const int &url)

Sets the url for the file that caused this error.

See also url().

### int QmlError::toString() const

Returns the error as a human readable string.

### int QmlError::url() const

Returns the url for the file that caused this error.

See also setUrl().

### QmlError &QmlError::operator=(const QmlError &other)

Assigns other to this error object.

## Member Variable Documentation

## Related Non-Members

## Macro Documentation