本文整理汇总了C++中QTimer::moveToThread方法的典型用法代码示例。如果您正苦于以下问题:C++ QTimer::moveToThread方法的具体用法?C++ QTimer::moveToThread怎么用?C++ QTimer::moveToThread使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTimer
的用法示例。
在下文中一共展示了QTimer::moveToThread方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void WUManager::init()
{
sendRequest();
QThread* workHorse = new QThread(this);
QTimer* timer = new QTimer(0);
QEventLoop* loop = new QEventLoop();
timer->setInterval(900000); // every hour read weather data
timer->moveToThread(workHorse);
connect(this, SIGNAL(replyProcessed()), loop, SLOT(quit()) );
connect(timer, SIGNAL(timeout()), this, SLOT(sendRequest()));
connect(workHorse, SIGNAL(started()), timer, SLOT(start()));
workHorse->start();
loop->exec();
QThread* workHorseSensors = new QThread(this);
QTimer* timerSensors = new QTimer(0);
timerSensors->setInterval(1000);
timerSensors->moveToThread(workHorse);
connect(timerSensors, SIGNAL(timeout()), this, SLOT(readSensors()));
connect(workHorseSensors, SIGNAL(started()), timerSensors, SLOT(start()));
workHorseSensors->start();
}
示例2: QObject
VOIP::VOIP(QObject* p) : QObject(p), speex(SAMPLE_RATE)
{
qRegisterMetaType<ALshortVector >();
rec = new Recorder(SAMPLE_RATE, this);
rec->startRecord();
connect(rec, SIGNAL(readyRead(ALshortVector)), &speex, SLOT(encode(ALshortVector)), Qt::QueuedConnection);
connect(&speex, SIGNAL(encoded(QByteArray)), this, SLOT(send(QByteArray)), Qt::QueuedConnection);
QTimer* updateT = new QTimer;
connect(updateT, SIGNAL(timeout()), this, SLOT(update()));
updateT->start(1000);
udpSocket = new QUdpSocket(this);
m_port=VOIP_DEFAULT_PORT;
m_receiver=0;
m_sound=new Sound(SAMPLE_RATE);
m_sound->play();
dataUp = 0;
setVolume(50);
m_enabled=true;
setQuality(4);
updateT->moveToThread(&m_thread);
moveToThread(&m_thread);
m_thread.start();
}
示例3: run
void Time::run()
{
int interval=5000;
QThread* somethread = new QThread(this);
QTimer *timer = new QTimer();
connect(timer, SIGNAL(timeout()), this, SLOT(VerifPing()));
timer->start();
timer->setInterval(interval);
timer->moveToThread(somethread);
somethread->start();
}
示例4: sigSetup
QCVWidget::QCVWidget(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::QCVWidget)
{
ui->setupUi(this);
//setup();
thread = new QThread();
RGBCamera *worker = new RGBCamera();
QTimer *workerTrigger = new QTimer();
workerTrigger->setInterval(1);
connect(workerTrigger, SIGNAL(timeout()), worker, SLOT(slotGrabFrame()));
connect(this, SIGNAL(sigSetup(int)), worker, SLOT(slotSetup(int)));
connect(worker, SIGNAL(sigFrame(QImage)), this, SLOT(slotFrame(QImage)));
workerTrigger->start();
worker->moveToThread(thread);
workerTrigger->moveToThread(thread);
thread->start();
emit sigSetup(0);
}