QQmlError Class
QQmlError クラスは QML エラーをカプセル化します。詳細...
ヘッダ | #include <QQmlError> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Qml) target_link_libraries(mytarget PRIVATE Qt6::Qml) |
qmake: | QT += qml |
パブリック関数
QQmlError() | |
QQmlError(const QQmlError &other) | |
int | column() const |
QString | description() const |
bool | isValid() const |
int | line() const |
QtMsgType | messageType() const |
QObject * | object() const |
void | setColumn(int column) |
void | setDescription(const QString &description) |
void | setLine(int line) |
void | setMessageType(QtMsgType messageType) |
void | setObject(QObject *object) |
void | setUrl(const QUrl &url) |
QString | toString() const |
QUrl | url() const |
QQmlError & | operator=(const QQmlError &other) |
関連する非メンバー
QDebug | operator<<(QDebug debug, const QQmlError &error) |
詳細な説明
QQmlError には、エラーのテキスト記述と位置情報(ファイル、行、列)が含まれます。toString() メソッドは、例えば、これらの情報をすべて含む、一行で人間が読める文字列を作成します:
file:///home/user/test.qml:7:8: Invalid property assignment: double expected
qDebug ()、qInfo ()、qWarning ()を使用すると、エラーをコンソールに出力できます。このメソッドは、エラーで示されたファイルを開こうとし、追加のコンテキスト情報を含めます。
file:///home/user/test.qml:7:8: Invalid property assignment: double expected y: "hello" ^
QQuickView::errors() およびQQmlComponent::errors()も参照して ください。
メンバ関数のドキュメント
QQmlError::QQmlError()
空のエラーオブジェクトを作成します。
QQmlError::QQmlError(const QQmlError &other)
other のコピーを作成する。
int QQmlError::column() const
エラーの列番号を返す。
setColumn()も参照 。
QString QQmlError::description() const
エラーの説明を返す。
setDescription()も参照 。
bool QQmlError::isValid() const
このエラーが有効な場合はtrueを返し、そうでない場合はfalseを返します。
int QQmlError::line() const
エラー行番号を返す。
setLine()も参照のこと 。
QtMsgType QQmlError::messageType() const
メッセージ・タイプを返します。
setMessageType()も参照 。
QObject *QQmlError::object() const
このエラーが発生した最も近いオブジェクトを返します。バインドされたプロパティ式の例外は、プロパティが属するオブジェクトにこれを設定します。それ以外の例外の場合は 0 になります。
setObject()も参照してください 。
void QQmlError::setColumn(int column)
エラーcolumn 番号を設定する。
column()も参照のこと 。
void QQmlError::setDescription(const QString &description)
エラーを設定するdescription 。
description()も参照のこと 。
void QQmlError::setLine(int line)
エラーline 番号を設定する。
line()も参照のこと 。
void QQmlError::setMessageType(QtMsgType messageType)
このメッセージのmessageType を設定する。メッセージ・タイプによって、どのQDebug ハンドラがメッセージの受信を担当するかが決まります。
messageType()も参照してください 。
void QQmlError::setObject(QObject *object)
このエラーが発生した場所に最も近いobject を設定する。
object()も参照のこと 。
void QQmlError::setUrl(const QUrl &url)
このエラーの原因となったファイルのurl を設定する。
url()も参照 。
QString QQmlError::toString() const
エラーを人間が読める文字列で返す。
QUrl QQmlError::url() const
このエラーの原因となったファイルの URL を返します。
setUrl()も参照 。
QQmlError &QQmlError::operator=(const QQmlError &other)
このエラーオブジェクトにother を割り当てる。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.