QDeclarativeError Class

The QDeclarativeError class encapsulates a QML error. 更多...

頭: #include <QDeclarativeError>
Since: Qt 4.7

公共函數

QDeclarativeError ()
QDeclarativeError (const QDeclarativeError & other )
int column () const
QString description () const
bool isValid () const
int line () const
void setColumn (int column )
void setDescription (const QString & 描述 )
void setLine (int line )
void setUrl (const QUrl & url )
QString toString () const
QUrl url () const
QDeclarativeError & operator= (const QDeclarativeError & other )
QDebug operator<< (QDebug debug , const QDeclarativeError & error )

詳細描述

The QDeclarativeError class encapsulates a QML error.

QDeclarativeError 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
					

可以使用 qDebug () 或 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"
           ^
					

另請參閱 QDeclarativeView::errors () 和 QDeclarativeComponent::errors ().

成員函數文檔編製

QDeclarativeError:: QDeclarativeError ()

Creates an empty error object.

QDeclarativeError:: QDeclarativeError (const QDeclarativeError & other )

創建副本為 other .

int QDeclarativeError:: column () const

Returns the error column number.

另請參閱 setColumn ().

QString QDeclarativeError:: description () const

Returns the error description.

另請參閱 setDescription ().

bool QDeclarativeError:: isValid () const

Returns true if this error is valid, otherwise false.

int QDeclarativeError:: line () const

Returns the error line number.

另請參閱 setLine ().

void QDeclarativeError:: setColumn ( int column )

Sets the error column 編號。

另請參閱 column ().

void QDeclarativeError:: setDescription (const QString & 描述 )

Sets the error 描述 .

另請參閱 description ().

void QDeclarativeError:: setLine ( int line )

Sets the error line 編號。

另請參閱 line ().

void QDeclarativeError:: setUrl (const QUrl & url )

設置 url for the file that caused this error.

另請參閱 url ().

QString QDeclarativeError:: toString () const

Returns the error as a human readable string.

QUrl QDeclarativeError:: url () const

Returns the url for the file that caused this error.

另請參閱 setUrl ().

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

賦值 other to this error object.

相關非成員

QDebug operator<< ( QDebug debug , const QDeclarativeError & error )

Outputs a human readable version of error to debug .