In the official Qt Documentation:
As mentioned, each program has one thread when it is started. This thread is called the "main thread" (also known as the "GUI thread" in Qt applications). The Qt GUI must run in this thread. All widgets and several related classes, for example QPixmap, don't work in secondary thread
Now, in a qt project i've tried the following code:
QThread* thread = new QThread;
DetectList *list = new DetectList;
list->moveToThread(thread);
connect(thread, SIGNAL(started()), list, SLOT(process()));
thread->start();
Where DetectList is a class derived by QWidget. Why the code compile and run? DetectList doesn't must be run only in the main thread?
Like Laszlo Papp point out you are receiving a warring and moveToThread
have no effect. Warring will say:
QObject::moveToThread: Widgets cannot be moved to a new thread
See source code of moveToThread.
I recommend you to describe what are you exacly trying to do and why you nead threads. I'm pretty sure there is better solution (like Qt Concurrent).