someclass::slot_make_next_thread()
{
// need some saved variables so we know which 'filenames' and which 's2' to pass on.
make_thread(filenames, s2);
}
someclass::make_thread(filenames, s2)
{
Worker *worker = new Worker(filenames,s2);
worker->moveToThread(thread);
connect(thread, SIGNAL(started()), worker, SLOT(process()));
connect(thread, SIGNAL(finished()), this, SLOT(slot_make_next_thread()));
connect(worker, SIGNAL(finished()), thread, SLOT(quit()));
thread->start();
}
someclass::slot_make_next_thread()
{
// need some saved variables so we know which 'filenames' and which 's2' to pass on.
make_thread(filenames, s2);
}
someclass::make_thread(filenames, s2)
{
QThread* thread = new QThread;
Worker *worker = new Worker(filenames,s2);
worker->moveToThread(thread);
connect(thread, SIGNAL(started()), worker, SLOT(process()));
connect(thread, SIGNAL(finished()), this, SLOT(slot_make_next_thread()));
connect(worker, SIGNAL(finished()), thread, SLOT(quit()));
thread->start();
}
To copy to clipboard, switch view to plain text mode
Bookmarks