2010-02-26 6 views
1

간단한 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 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(); 

} 

답변

2

스레드를 만들뿐만 아니라 실제로 시작해야합니다. 또한 줄 바꿈 문자 (\n)를 종료하지 않은 경우 GUI가 표시되기 전에 printf() 문이 실행됩니다.

관련 문제