My IDE Qt 5.0.1 Linux Platform
I have a problem installing a widget in a window. (My opinion)
this is my main.cpp â
int main(int argc, char *argv[]) { QApplication a(argc, argv); QThread cThread; MainWindow w; w.doSetup(cThread); w.moveToThread(&cThread); cThread.start(); if(cThread.isRunning()) { qDebug() << " Thread is Running..."; } w.show(); return a.exec(); }
this is the doSetup () method ->
void MainWindow::doSetup(QThread &mainThread) { QObject::connect(&mainThread, &QThread::started, this, &MainWindow::activeLoopMainC); }
I checked the signal slot mechanism and it works.
slot method â
void MainWindow::activeLoopMainC() { qDebug() << " Signal-Slot structure working successfully.."; mainThreadProc((void*)(instAddr)); }
I call a function from my main.c with this method of slots.
There is no problem with working codes in debugging. But my window is empty. there is only a frame.
i error message appears: QObject :: moveToThread: widgets cannot be transferred to a new thread
How can I solve this problem?
Thank you in advance for your answers.
source share