本文整理汇总了C++中Producer::moveToThread方法的典型用法代码示例。如果您正苦于以下问题:C++ Producer::moveToThread方法的具体用法?C++ Producer::moveToThread怎么用?C++ Producer::moveToThread使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Producer
的用法示例。
在下文中一共展示了Producer::moveToThread方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QMainWindow
progressDialog::progressDialog(QWidget *parent, Qt::WFlags flags)
: QMainWindow(parent, flags){
ui.setupUi(this);
Consumer *c = new Consumer();
Producer *p = new Producer();
Thread *t1 = new Thread(0);
Thread *t2 = new Thread(0);
connect(this,SIGNAL(begin(bool)),c,SLOT(startReceiving(bool)));
connect(c,SIGNAL(initiate(bool)),p,SLOT(produce(bool)));
connect(p,SIGNAL(sendPacket(const QByteArray,bool)),c,SLOT(receiveFrame(const QByteArray,bool)));
connect(ui.pushButton,SIGNAL(clicked(bool)),this,SLOT(_begin(bool)));
connect(p,SIGNAL(halt(bool)),c,SLOT(startReceiving(bool)));
connect(c,SIGNAL(blockDone()),p,SLOT(frameData()));
connect(c,SIGNAL(measure(bool)),p,SLOT(measurement(bool)),Qt::DirectConnection);
connect(c,SIGNAL(openDialog()),this,SLOT(startDlg()));
connect(c,SIGNAL(closeDialog()),this,SLOT(closeDlg()));
connect(p,SIGNAL(setDlgMax(int)),this,SLOT(setMaxVal(int)));
connect(p,SIGNAL(setDlgVal(int)),this,SLOT(setVal(int)));
connect(p,SIGNAL(setSeconds(int)),this,SLOT(setSecondsRemaining(int)));
c->moveToThread(t1);
p->moveToThread(t2);
t1->start();
t2->start();
}