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 のサブクラスでない例外をスローした場合、関数は受信スレッド側で QUnhandledException をスローします。 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-QUnhandledExceptionを構成し、other が指していたのと同じオブジェクトを指すようにする。
[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)
このQUnhandledException オブジェクトにother を割り当て、この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.