Multithreading 可以在线程上运行主QT程序吗?

Multithreading 可以在线程上运行主QT程序吗?,multithreading,qt,Multithreading,Qt,我有一个简单的QT对象。当我执行下面的代码时,控件被传输到QT对象,但是我想让QT部分像线程一样工作 int main(int argc, char *args[]) { gui *GUI; //// before call QApplication app(argc,args); GUI = new gui(); GUI->show(); ////i want to be able to do stuff here in parall

我有一个简单的QT对象。当我执行下面的代码时,控件被传输到QT对象,但是我想让QT部分像线程一样工作

int main(int argc, char *args[])
{
    gui *GUI;
    //// before call 

    QApplication app(argc,args);
    GUI = new gui();    
    GUI->show();

////i want to be able to do stuff here in parallel with the QT code.
// If I spawn a thead here or give a simple printf statement here
// or before call it executes only after GUI exits

return app.exec();

}

确保您不仅创建了线程,而且实际启动了它。此外,除非忘记用换行符(
\n
)终止字符串,否则将在GUI显示之前执行
printf()
语句