QUnhandledException 类表示 Qt Concurrent 工作者线程中的未处理异常。 更多...
| 头: | #include <QUnhandledException> | 
| CMake: | 
								find_package(Qt6 COMPONENTS Core REQUIRED)
								 target_link_libraries(mytarget PRIVATE Qt6::Core)  | 
						
| qmake: | QT += core | 
| Since: | Qt 5.0 | 
| 继承: | QException | 
| QUnhandledException (const QUnhandledException & other ) | |
| QUnhandledException (QUnhandledException && other ) | |
| QUnhandledException (std::exception_ptr exception = nullptr) | |
| QUnhandledException & | operator= (const QUnhandledException & other ) | 
| std::exception_ptr | exception () const | 
| void | swap (QUnhandledException & other ) | 
If a worker thread throws an exception that is not a subclass of QException , Qt Concurrent functions will throw a QUnhandledException on the receiver thread side. The information about the actual exception that has been thrown will be saved in the QUnhandledException class and can be obtained using the exception () method. For example, you can process the exception held by QUnhandledException in the following way:
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' } }
Inheriting from this class is not supported.
Constructs a QUnhandledException object as a copy of other .
Move-constructs a QUnhandledException, making it point to the same object as other 所指向的。
[since 6.0]
						
						QUnhandledException::
						
							QUnhandledException
						
						(
						
							std::exception_ptr
						
						
							exception
						
						= nullptr)
						
					Constructs a new QUnhandledException object. Saves the pointer to the actual exception object if exception 被传递。
该函数在 Qt 6.0 引入。
另请参阅 exception ().
赋值 other 到此 QUnhandledException 对象并返回引用为此 QUnhandledException 对象。
[since 6.0]
						
						
							std::exception_ptr
						
						QUnhandledException::
						
							exception
						
						() const
						
					
						返回
						
							pointer
						
						to the actual exception that has been saved in this
						
							QUnhandledException
						
						。返回
						
null
						
						pointer, if it does not point to an exception object.
					
该函数在 Qt 6.0 引入。
[since 6.0]
						
						
							void
						
						QUnhandledException::
						
							swap
						
						(
						
							
								QUnhandledException
							
						
						&
						
							other
						
						)
						
					交换此 QUnhandledException with other 。此函数非常快且从不失败。
该函数在 Qt 6.0 引入。