QQmlError Class

QQmlError 클래스는 QML 오류를 캡슐화합니다. 더 보기...

Header: #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

이 오류가 유효하면 참을 반환하고, 그렇지 않으면 거짓을 반환합니다.

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 을 할당합니다.

관련 비회원

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

error 의 사람이 읽을 수 있는 버전을 debug 으로 출력합니다.

© 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.