Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QQmlError Class Reference

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

#include <qqmlerror.h>

Collaboration diagram for QQmlError:

Public Member Functions

 QQmlError ()
 Creates an empty error object.
 QQmlError (const QQmlError &)
 Creates a copy of other.
 QQmlError (QQmlError &&other) noexcept
QQmlErroroperator= (const QQmlError &)
 Assigns other to this error object.
 ~QQmlError ()
void swap (QQmlError &other)
bool isValid () const
 Returns true if this error is valid, otherwise false.
QUrl url () const
 Returns the url for the file that caused this error.
void setUrl (const QUrl &)
 Sets the url for the file that caused this error.
QString description () const
 Returns the error description.
void setDescription (const QString &)
 Sets the error description.
int line () const
 Returns the error line number.
void setLine (int)
 Sets the error line number.
int column () const
 Returns the error column number.
void setColumn (int)
 Sets the error column number.
QObjectobject () const
 Returns the nearest object where this error occurred.
void setObject (QObject *)
 Sets the nearest object where this error occurred.
QtMsgType messageType () const
void setMessageType (QtMsgType messageType)
QString toString () const
 Returns the error as a human readable string.

Friends

bool Q_QML_EXPORT operator== (const QQmlError &a, const QQmlError &b)

(Note that these are not member symbols.)

QDebug operator<< (QDebug debug, const QQmlError &error)
 Outputs a human readable version of error to debug.

Detailed Description

The QQmlError class encapsulates a QML error.

Since
5.0 \inmodule QtQml

QQmlError 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:

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.

y: "hello"
^
GLint y
See also
QQuickView::errors(), QQmlComponent::errors()

Definition at line 18 of file qqmlerror.h.

Constructor & Destructor Documentation

◆ QQmlError() [1/3]

QQmlError::QQmlError ( )

Creates an empty error object.

Definition at line 64 of file qqmlerror.cpp.

◆ QQmlError() [2/3]

QQmlError::QQmlError ( const QQmlError & other)

Creates a copy of other.

Definition at line 72 of file qqmlerror.cpp.

◆ QQmlError() [3/3]

QQmlError::QQmlError ( QQmlError && other)
inlinenoexcept

Definition at line 23 of file qqmlerror.h.

◆ ~QQmlError()

QQmlError::~QQmlError ( )

Definition at line 102 of file qqmlerror.cpp.

Member Function Documentation

◆ column()

int QQmlError::column ( ) const

Returns the error column number.

Definition at line 178 of file qqmlerror.cpp.

◆ description()

QString QQmlError::description ( ) const

Returns the error description.

Definition at line 138 of file qqmlerror.cpp.

◆ isValid()

bool QQmlError::isValid ( ) const

Returns true if this error is valid, otherwise false.

Definition at line 110 of file qqmlerror.cpp.

◆ line()

int QQmlError::line ( ) const

Returns the error line number.

Definition at line 158 of file qqmlerror.cpp.

◆ messageType()

QtMsgType QQmlError::messageType ( ) const
Since
5.9

Returns the message type.

Definition at line 223 of file qqmlerror.cpp.

◆ object()

QObject * QQmlError::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.

Definition at line 201 of file qqmlerror.cpp.

◆ operator=()

QQmlError & QQmlError::operator= ( const QQmlError & other)

Assigns other to this error object.

Definition at line 81 of file qqmlerror.cpp.

◆ setColumn()

void QQmlError::setColumn ( int column)

Sets the error column number.

Definition at line 188 of file qqmlerror.cpp.

◆ setDescription()

void QQmlError::setDescription ( const QString & description)

Sets the error description.

Definition at line 148 of file qqmlerror.cpp.

◆ setLine()

void QQmlError::setLine ( int line)

Sets the error line number.

Definition at line 168 of file qqmlerror.cpp.

◆ setMessageType()

void QQmlError::setMessageType ( QtMsgType messageType)
Since
5.9

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

Definition at line 236 of file qqmlerror.cpp.

◆ setObject()

void QQmlError::setObject ( QObject * object)

Sets the nearest object where this error occurred.

Definition at line 211 of file qqmlerror.cpp.

◆ setUrl()

void QQmlError::setUrl ( const QUrl & url)

Sets the url for the file that caused this error.

Definition at line 128 of file qqmlerror.cpp.

◆ swap()

void QQmlError::swap ( QQmlError & other)
inline

Definition at line 31 of file qqmlerror.h.

◆ toString()

QString QQmlError::toString ( ) const

Returns the error as a human readable string.

Definition at line 246 of file qqmlerror.cpp.

◆ url()

QUrl QQmlError::url ( ) const

Returns the url for the file that caused this error.

Definition at line 118 of file qqmlerror.cpp.

◆ operator<<()

QDebug operator<< ( QDebug debug,
const QQmlError & error )
related

Outputs a human readable version of error to debug.

Definition at line 283 of file qqmlerror.cpp.

◆ operator==

bool Q_QML_EXPORT operator== ( const QQmlError & a,
const QQmlError & b )
friend

Definition at line 271 of file qqmlerror.cpp.


The documentation for this class was generated from the following files: