I also want to use QT for user interface. Is there any examples?
I decide to create thread and execute main loop of QT application in this thread.
[pre:g779cno0]DWORD WINAPI mainLoop(CONST LPVOID lpParam) {
coreDataStruct * data = (coreDataStruct *)lpParam;
int argc = 0;
char **argv = 0;
data->app = new QApplication(argc, argv);
data->app->setQuitOnLastWindowClosed(false);
data->app->exec();
data->active = 0;
ExitThread(0);
}
VALUE cModule_initialize(...) {
if (coreData->active == 0) {
HANDLE thread = CreateThread(NULL, 0, &mainLoop, (void*)coreData, 0, NULL);
coreData->mainThread = thread;
coreData->active = 1;
return Qtrue;
}
return Qfalse;
}[/pre:g779cno0]
Thread is created in function cModule_initialize that should be executed in the begining
To create window I have this function:
[pre:g779cno0]VALUE cModule_createWin(...) {
if (coreData->active == 0) return Qfalse;
QDialog *dialog = new QDialog;
dialog->show();
return Qtrue;
}[/pre:g779cno0]
Is that correct?