I am trying to create this QT gui using a thread but no luck. Below is my code. Problem is gui never shows up.
/*INCLUDES HERE...
....
*/
using namespace std;
struct mainStruct {
int s_argc;
char ** s_argv;
};
typedef struct mainStruct mas;
void *guifunc(void * arg);
int main(int argc, char * argv[]) {
mas m;<br>
m.s_argc = argc;
m.s_argv = argv;
pthread_t threadGUI;
//start a new thread for gui
int result = pthread_create(&threadGUI, NULL, guifunc, (void *) &m);
if (result) {
printf("Error creating gui thread");
exit(0);
}
return 0;
}
void *guifunc(void * arg)
{
mas m = *(mas *)arg;
QApplication app(m.s_argc,m.s_argv);
//object instantiation
guiClass *gui = new guiClass();
//show gui
gui->show();
app.exec();
}