// Thread1 to init screens except Settings
connect(Thread1, SIGNAL(started()), this, SLOT(thread1_run()),Qt::DirectConnection);
connect(this, SIGNAL(thread1Finished()), this, SLOT(thread1_finish()));
// Thread2 to init Settings screen(Heavy Screen)
connect(Thread2, SIGNAL(started()), this, SLOT(thread2_run()),Qt::DirectConnection);
connect(this, SIGNAL(thread2Finished()), this, SLOT(thread2_finish()));
// Stack widgets
connect(this,SIGNAL(threadsDone()),this,SLOT(stackWidgets()));
Thread1
->start
(QThread::HighestPriority);
Thread2
->start
(QThread::HighestPriority);
// Thread1 to init screens except Settings
Thread1 = new QThread;
connect(Thread1, SIGNAL(started()), this, SLOT(thread1_run()),Qt::DirectConnection);
connect(this, SIGNAL(thread1Finished()), this, SLOT(thread1_finish()));
// Thread2 to init Settings screen(Heavy Screen)
Thread2 = new QThread;
connect(Thread2, SIGNAL(started()), this, SLOT(thread2_run()),Qt::DirectConnection);
connect(this, SIGNAL(thread2Finished()), this, SLOT(thread2_finish()));
// Stack widgets
connect(this,SIGNAL(threadsDone()),this,SLOT(stackWidgets()));
Thread1->start(QThread::HighestPriority);
Thread2->start(QThread::HighestPriority);
To copy to clipboard, switch view to plain text mode
But from Above code, The threads are executing one after another. They aren't running parallel. Can you help how to run these parallel?
Bookmarks