이 페이지에서

QException Class

QException 클래스는 스레드 간에 전달될 수 있는 예외를 위한 기본 클래스를 제공합니다. 더 보기...

헤더: #include <QException>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
상속된 항목:

QUnhandledException

공개 함수

QException()
QException(const QException &other)
virtual ~QException()
virtual QException *clone() const
virtual void raise() const
QException &operator=(const QException &other)

상세 설명

Qt Concurrent 예외가 QException을 상속받고 다음 두 가지 보조 함수를 구현하는 경우, 스레드 경계를 넘어 예외를 발생시키고 처리할 수 있습니다:

class MyException : public QException
{
public:
    void raise() const override { throw *this; }
    MyException *clone() const override { return new MyException(*this); }
};

QException의 하위 클래스는 값으로 던져져야 하며 참조로 잡아야 합니다:

try  {
    QtConcurrent::blockingMap(list, throwFunction); // throwFunction throws MyException
} catch (MyException &e) {
    // handle exception
}

QException의 서브클래스가 아닌 예외를 발생시키면, Qt Concurrent 해당 함수들은 수신 스레드에서 ` QUnhandledException ` 예외를 발생시킵니다.

QFuture 를 사용할 경우, 다음 함수를 호출할 때 전달된 예외가 발생합니다:

멤버 함수 설명서

[noexcept default] QException::QException()

QException 객체를 생성합니다.

[constexpr noexcept default] QException::QException(const QException &other)

other 의 복사본을 생성합니다.

참고: 이 함수를 사용할 때는 슬라이싱(slicing)이 발생할 수 있으므로주의하십시오 .

clone()도 참조하십시오 .

[virtual noexcept] QException::~QException()

이 QException 객체를 삭제합니다.

[virtual] QException *QException::clone() const

QException 의 서브클래스에서 clone() 메서드를 다음과 같이 재구현하세요:

MyException *MyException::clone() const { return new MyException(*this); }

[virtual] void QException::raise() const

QException 의 서브클래스에서 raise() 메서드를 다음과 같이 재구현하십시오:

void MyException::raise() const { throw *this; }

[noexcept default] QException &QException::operator=(const QException &other)

이 객체에 대해 ` other `을 복사 할당합니다.

참고: 이 함수를 사용할 때는 슬라이싱이 발생할 수 있으므로주의하십시오 .

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