void GenericThread::initialize(bool isThreaded) { _isThreaded = isThreaded; if (_isThreaded) { _thread = new QThread(this); // when the worker thread is started, call our engine's run.. connect(_thread, SIGNAL(started()), this, SLOT(threadRoutine())); this->moveToThread(_thread); // Starts an event loop, and emits _thread->started() _thread->start(); } }
void GenericThread::initialize(bool isThreaded, QThread::Priority priority) { _isThreaded = isThreaded; if (_isThreaded) { _thread = new QThread(this); // match the thread name to our object name _thread->setObjectName(objectName()); _thread->setPriority(priority); // when the worker thread is started, call our engine's run.. connect(_thread, SIGNAL(started()), this, SLOT(threadRoutine())); this->moveToThread(_thread); // Starts an event loop, and emits _thread->started() _thread->start(); } }