StupidBeauty
Read times:514Posted at:Tue May 22 18:58:39 2012
- no title specified

Qt4.8文档翻译:Exception类参考,Exception Class Reference

详细说明

Exception类为那些可在线程之间传递的异常提供咯一个基类。

Qt Concurrent支持在线程之间抛出及捕获异常,前提条件是该异常继承自QtConcurrent::Exception 并且实现咯两个辅助函数:

class MyException : public QtConcurrent ::Exception

{

public:

void raise() const { throw *this; }

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

};

QtConcurrent::Exception的子类必需以值的方式抛出,以引用的方式来捕获:

try {

QtConcurrent ::blockingMap(list, throwFunction); // throwFunction抛出MyException

} catch (MyException &e) {

//处理异常

}

如果妳抛出一个并非是QtConcurrent::Exception 子类的异常,则Qt Concurrent 函数会在接收的线程里抛出一个 QtConcurrent::UnhandledException

在使用 QFuture 时,调用以下函数会抛出已传递的异常:

Your opinions
Your name:Email:Website url:Opinion content:
- no title specified

HxLauncher: Launch Android applications by voice commands

 
Recent comments
2017年4月~2019年4月垃圾短信排行榜Posted at:Thu Sep 26 04:51:48 2024
Qt5.7文档翻译:QWebEngineCookieStore类,QWebEngineCookieStore ClassPosted at:Fri Aug 11 06:50:35 2023盲盒kill -9 18289 Grebe.20230517.211749.552.mp4