主线程中有两个变量QPushButton *btn,QLabel *lab想通过自定义线程的构造函数传递次线程。
请问我的构造函数应该怎么写,我在dialog中怎么调用构造函数传递参数。
------解决方案--------------------
你的次线程构造函数:
class YourSencondThread: public QThread
{
public:
explicit YourSencondThreadQPushButton *btn,QLabel *lab, QObject *parent = 0);//构造函数有默认值的要放后面
}
dialog中 :
YourSencondThread *thread = new YourSencondThread(button, label);
thread->start();//启动