我自定义了一个事件,现在自己建的线程中post这个自定义事件传递参数给GUI
代码为:
NotfyGuI *e = new NotfyGuI (int ,int );
QThread::postEvent(TargetWidget,ce);
TargetWidget参数是我从主页面保存进来的。
在主页面中,重载了customEvent()函数
customEvent(QCustomEvent *e)
{
NotfyGuI *ce =(NotfyGuI *)e;
qDebug(" %d,%d", ce->get(),ce->get2());
}
大概就是这个样子,编译可以通过,但是运行过程中, 就是不能显示出来传递的数据。
请各位大虾看看这个问题!