이 페이지에서

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

관련 비멤버

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

error 의 사람이 읽기 쉬운 버전을 debug 에 출력합니다.

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