QUnhandledException Class
QUnhandledException 클래스는 Qt Concurrent 작업자 스레드에서 처리되지 않은 예외를 나타냅니다. 더 보기...
헤더: | #include <QUnhandledException> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core) |
qmake: | QT += core |
상속합니다: | QException |
공용 함수
(since 6.0) | QUnhandledException(std::__exception_ptr::exception_ptr exception = nullptr) |
QUnhandledException(const QUnhandledException &other) | |
QUnhandledException(QUnhandledException &&other) | |
(since 6.0) std::__exception_ptr::exception_ptr | exception() const |
(since 6.0) void | swap(QUnhandledException &other) |
QUnhandledException & | operator=(const QUnhandledException &other) |
자세한 설명
작업자 스레드가 QException 의 서브 클래스가 아닌 예외를 던지면 Qt Concurrent 함수는 수신자 스레드 측에 QUnhandledException을 던집니다. 실제 던져진 예외에 대한 정보는 QUnhandledException 클래스에 저장되며 exception() 메서드를 사용하여 얻을 수 있습니다. 예를 들어, 다음과 같은 방법으로 QUnhandledException이 보유한 예외를 처리할 수 있습니다:
try { auto f = QtConcurrent::run([] { throw MyException {}; }); // ... } catch (const QUnhandledException &e) { try { if (e.exception()) std::rethrow_exception(e.exception()); } catch (const MyException &ex) { // Process 'ex' } }
이 클래스에서 상속은 지원되지 않습니다.
멤버 함수 문서
[noexcept, since 6.0]
QUnhandledException::QUnhandledException(std::__exception_ptr::exception_ptr exception = nullptr)
새 QUnhandledException 객체를 생성합니다. exception 이 전달되면 실제 예외 객체에 대한 포인터를 저장합니다.
이 함수는 Qt 6.0에 도입되었습니다.
exception()도 참조하십시오 .
[noexcept]
QUnhandledException::QUnhandledException(const QUnhandledException &other)
other 의 복사본으로 QUnhandledException 객체를 생성합니다.
[noexcept]
QUnhandledException::QUnhandledException(QUnhandledException &&other)
Move는 other 가 가리키고 있던 것과 동일한 객체를 가리키도록 QUnhandledException을 생성합니다.
[since 6.0]
std::__exception_ptr::exception_ptr QUnhandledException::exception() const
이 QUnhandledException 에 저장된 실제 예외에 대한 포인터를 반환합니다. 예외 객체를 가리키지 않으면 null
포인터를 반환합니다.
이 함수는 Qt 6.0에 도입되었습니다.
[noexcept, since 6.0]
void QUnhandledException::swap(QUnhandledException &other)
이 처리되지 않은 예외 객체를 other 로 바꿉니다. 이 작업은 매우 빠르며 절대 실패하지 않습니다.
이 함수는 Qt 6.0에 도입되었습니다.
[noexcept]
QUnhandledException &QUnhandledException::operator=(const QUnhandledException &other)
other 을 이 QUnhandledException 객체에 할당하고 이 QUnhandledException 객체에 대한 참조를 반환합니다.
© 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.