1.在mainwindow的添加成员:
QSubObj m_Obj;
QThread m_SubThread;
2.mainwindow构造函数中设置:
m_Obj.moveToThread(&m_SubThread);
m_SubThread.start();
3.mainwindow构造函数中绑定:
connect(&m_Obj,SIGNAL(Yoursignal()),this,SLOT(YourSlot()));
以后要想子线程向主线程中发消息,只需在子线程中使用emit Yoursignal()就可以了,当然,提到的信号和槽函数,都需要你来声明和实现的。