-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
37 lines (29 loc) · 820 Bytes
/
main.cpp
File metadata and controls
37 lines (29 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <QApplication>
#include <signal.h>
#include <EApi.h>
#include <QDesktopWidget>
#include "mainwindow.h"
void signalhandler(int sig){
if(sig==SIGINT){
EApiLibUnInitialize();
qApp->quit();
}
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
if(!EAPI_TEST_SUCCESS(EApiLibInitialize()))
exit(0);
MainWindow *w = new MainWindow();
QDesktopWidget wid;
int width = w->frameGeometry().width();
int height = w->frameGeometry().height();
int screenWidth = wid.screen()->width();
int screenHeight = wid.screen()->height();
w->setGeometry((screenWidth/2)-(width/2),(screenHeight/2)-(height/2),width,height);
w->show();
signal(SIGINT, signalhandler);
const int ret = a.exec();
EApiLibUnInitialize();
return ret;
}