【发布时间】:2016-07-01 11:14:26
【问题描述】:
在多线程 Qt 应用程序中重新实现 notify 函数时要注意什么?
这是一个示例实现。 目前没有错误,但我担心可能会出现错误,因为 Qt 中的多线程使用使用通知功能的信号槽进行通信。
TApplication::notify(QObject *receiver, QEvent *event)
{
bool returnValue(false);
try
{
returnValue = QApplication::notify(receiver, event);
}
catch (IExceptionBase& e)
{
if (!fMain.isNull())
{
//report error to output and file log
}
else
{
//report error to output
}
}
catch (...)
{
if (!fMain.isNull())
{
//report error to output and file log
}
else
{
//report error to output
}
}
return returnValue;
}
fMain 是一个具有报告功能的模块
【问题讨论】:
标签: c++ qt qthread qapplication