16,239
社区成员
发帖
与我相关
我的任务
分享
class MyThread : public QThread
{
Q_OBJECT
public:
MyThread();
void run()
{
emit threadSignal();
}
signals:
void threadSignal();
};
class Receiver : public QObject
{
Q_OBJECT
public:
Receiver()
{
MyThread * thread = new MyThread;
connect(thread, SIGNAL(threadSignal()), this, SLOT(slotFunc()));
thread->start();
}
private slots:
void slotFunc()
{
qDebug() << "receive one signal.";
}
};